SQL 2000 DTS 包的 VB 脚本 ActiveX 任务
我正在尝试从外部 csv 文件加载数据,在插入 SQL 表之前需要对其进行处理。 读取文件很好,但是当我尝试循环流并使用 SPLIT 函数加载数组时,出现“预期语句结束”错误。
Do While Not txtFile.AtEndOfStream
strText = txtFile.ReadLine
Dim dataArray() As String = Split(strText, ",") -- Here's where it breaks
...
build sql statement to insert using the zero based array
RS.Open strSQL, dbConn, adOpenKeyset
Loop
txtFile.Close
我已经查看了 BOL 和 MSDN,但仍然收到错误。
I'm trying to load data from an external csv file that needs to be massaged before being inserted into a SQL table. Reading the file is fine, but when I try to loop through the stream and load an array using the SPLIT function I get a "Expected End of Statement" error.
Do While Not txtFile.AtEndOfStream
strText = txtFile.ReadLine
Dim dataArray() As String = Split(strText, ",") -- Here's where it breaks
...
build sql statement to insert using the zero based array
RS.Open strSQL, dbConn, adOpenKeyset
Loop
txtFile.Close
I've looked at the BOL and MSDN, but I'm still getting the error.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
VBScript 不支持类型变量。 VBScript 不支持在 Dim 语句中赋值。 使用:-
然而,既然这是 DTS 任务,为什么不在转换中创建文本 csv 数据源,而不是手动创建 VBScript 代码来使用 CSV。
VBScript does not support typed variables. VBScript does not support assigning a value in the Dim statement. Use:-
However having said that since this is DTS task why aren't you creating a text csv data source in the transfrom rather than manually creating VBScript code to consume the CSV.
根据记忆,SQL 2k DTS 使用 vb 脚本,因此没有类型。
From memory SQL 2k DTS uses vb scripts so no types.