Vbscript 长变量写入文件

Vbscript 长变量写入文件,vbscript,long-integer,Vbscript,Long Integer,我有一个连接到db2的vbscript,recset获取长VARCHAR18000(包含xml消息)。 问题是vbscript中的变量长度只有250。 好的,我已经将recset划分为数组(50)每个字符串250个字符。 然后,当我试图将第一个字符串从数组传递到文件时,它抛出错误。 因为在数组(0)字符串中有很多引号。如何将结果保存到文件 sql = "select message_data from messages where MESSAGE_ID = '5461654648464'" S

我有一个连接到db2的vbscript,recset获取长VARCHAR18000(包含xml消息)。 问题是vbscript中的变量长度只有250。 好的,我已经将recset划分为数组(50)每个字符串250个字符。 然后,当我试图将第一个字符串从数组传递到文件时,它抛出错误。 因为在数组(0)字符串中有很多引号。如何将结果保存到文件

sql = "select message_data from messages where MESSAGE_ID = '5461654648464'"

Set objConnection = CreateObject("ADODB.Connection")
objConnection.ConnectionString = "Provider=ibmdadb2; DSN=TEST; UID=user; PWD=password"
objConnection.Open
Set recset = CreateObject("ADODB.Recordset")

recset.Open sql,objConnection 

if recset.EOF then WScript.Echo "No found" else splt recset("message_data") end if

recset.Close
objConnection.Close

function splt (strg)
dim arr(50)
Set fso = CreateObject("Scripting.FileSystemObject") 
sFolder = "C:\jdk1.3\temp\arch" 
Set NewFile = fso.CreateTextFile(sFolder&"\file.txt", True) 

 if len(strg) > 250 then ll = round(len(strg)/250, 0) + 1

for i = 0 to ll
arr(i) = left(right(strg, abs(Cint(len(strg))-250*i)), 250)

txt = arr(i)

NewFile.Write txt
next

NewFile.Close
End function

@Ruslan:首先确保文件存在(它可能只是一个空白文本文件),我建议你也用

Dim arr(50), fso, sFolder, NewFile, ll, txt, i

并在文件顶部添加
选项Explicit

“vbscript中的变量长度只有250”是什么意思?这不是一个正常的限制..您能给出您看到的确切错误消息吗?无效的进程或调用参数字符串:NewFile.Writetxt@Ruslan:如果这不能解决问题,您是否可以发布产生错误的数据字符串的一部分(理想情况下是250或500个字符)?