VBA字符串限制 [英] VBA String Limit

查看:157
本文介绍了VBA字符串限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在Microstation V8i SS2中的Visual Basic for Applications(VBA)中工作,我的String值出现溢出错误.

I've been working in Visual Basic for Applications (VBA) in Microstation V8i SS2, and I'm getting an Overflow error for my String value.

VBA中似乎对String值有限制.限制似乎是255个字符.仔细阅读后,许多消息人士称它可以支持多达20亿个字符.这不是真的吗?

It seems there is a limit in VBA for String values. The limit seems to be 255 characters. Reading up on it, a lot of sources says it can support up to 2 billion characters. This is not true?

发生的事情是,我正在使用ADO与数据库进行交互,因此我在VBA中构建了自己的SQL INSERT语句. INSERT语句变长,如300多个字符,这取决于接受多行文本值的注释"列.

What happens is, I'm using ADO to interact with the database, so I'm building my own SQL INSERT statement inside the VBA. The INSERT statement gets long, like 300+ characters, depending on the 'Comments' column that accepts a multi-line text value.

有人解决吗?我是否应该从.NET的角度编写自己的COM插件,而该插件在VBA中得到引用?

Anybody have a solution? Should I write my own COM-Addin from a .NET point of view, that gets referenced in the VBA?

推荐答案

VBA字符串可以超过255个字符.

VBA strings can be more than 255 chars.

一个可能的罪魁祸首是如何在表中声明该列....Comments列是否声明为varchar(255)?

A possible culprit is how the column is declared in your table.... Is the Comments column declared as varchar(255)?

从帮助文件:

  • 可变长度的字符串最多可以包含大约20亿(2 ^ 31)个字符.

  • A variable-length string can contain up to approximately 2 billion (2^31) characters.

固定长度的字符串可以包含1到大约64K(2 ^ 16)个字符.

A fixed-length string can contain 1 to approximately 64K (2^16) characters.

参考.

这篇关于VBA字符串限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆