师哥师姐,帮帮我!~~一个菜鸟问题,急~~

aBoris 2003-08-21 11:48:51
12920241 2002-08-15 11:27:00 01
12918338 2002-08-15 12:30:00 01
12920210 2002-08-15 12:31:00 01
12913650 2002-08-15 12:31:00 01
12919060 2002-08-15 12:31:00 01
12917212 2002-08-15 12:31:00 01
===============以上是2002-08-15.txt内容===============

<!-- #Include File="../dsn/conn.asp" -->
<%
Dim fso,strFso
Dim temp,counter,tempArray,strSql
Set fso = server.CreateObject("Scripting.FileSystemObject")
Set strFso = fso.OpenTextFile("d:\test\files\2002-08-15.txt", 1)
Do While strFso.AtEndOfStream <> True
temp = temp & strFso.readline
loop
Set fso=nothing
Set strFso = nothing
'将读出来的按成数组
tempArray = split(temp)
'12920241 2002-08-15 11:27:00 01
'1......8...
for i=LBOUND(tempArray) to UBOUND(tempArray)
str1=Mid(tempArray, 1, 8) '卡号:12920241
str2=Mid(tempArray, 10, 19) '日期:2003-08-15
str3=Mid(tempArray, 21, 28) '时间:11:27:00
str4=Mid(tempArray, 30, 31) '机号:01
sql=insert into attendance (staff_ID,rDate,rTime,rNO) values ('"&str1&"',
'"&str2&"','"&str3&"','"&str4&"')
conn.execute(sql)
next

执行到这一句系统就报错:
str1=Mid(tempArray, 1, 8) '卡号:12920241


帮我看看,我的程序那里有问题??

...全文
64 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
ttt2 2003-08-21
  • 打赏
  • 举报
回复
tempArray = split(temp," ")
conner 2003-08-21
  • 打赏
  • 举报
回复
到这句话时str1=Mid(tempArray, 1, 8)
tempArray已经都是数组了,所以要出错了,既然你已经用数组了,何必还要用函数mid来截取字符窜呢,现在在数组tempArray中
tempArray(0)就是'12920241’
tempArray(1)就是'2002-08-15'
tempArray(2)就是'11:27:00'
tempArray(3)就是'01'
aBoris 2003-08-21
  • 打赏
  • 举报
回复
************我是在一个人事管理系统用呀。********

str1=Mid(tempArray, 1, 8)

执行到上面一句系统就报错:

Microsoft VBScript 编译器错误 错误 '800a03f6'

缺少 'End'

/iisHelp/common/500-100.asp,行242

Microsoft VBScript 运行时错误 错误 '800a000d'

类型不匹配: 'tempArray'

/EIP2.1/attendx/inportdata_save2.asp,行47
lions911 2003-08-21
  • 打赏
  • 举报
回复
把文本文件导入到SQLSERVER中,用这么费劲吗

直接用SQL的导入工具不就行了?
lang11zi 2003-08-21
  • 打赏
  • 举报
回复
up

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧