帮忙看看这个程序,为什么在98下没问题,到XP下就出错了?存储过程转换文本.
源代码如下:
On Error GoTo err
Screen.MousePointer = 11
Frmflash.Show
Frmflash.Refresh
Dim FileName As String
Dim DATESTR As String
Dim FLNSTR As String
DATESTR = Format(Date, "yyyymmdd")
FLNSTR = Left(WinDir, 1) & ":\Program Files\JAT\IT-6000 考勤系统(标准版)\Data\" & DATESTR & ".txt"
FileName = Dir(App.Path & "\data\data.txt")
If FileName <> "" Then
Kill FileName
Else
If DirExists(App.Path & "\data") = False Then ' 检查目录是否存在
Call MakeDir(App.Path & "\data") '创建目录
End If
End If
FileName = Dir(FLNSTR)
'------------处理数据
If FileName <> "" Then
'------------------------复制备份文件到服务器
If DirExists(App.Path & "\bak") = False Then ' 检查目录是否存在
Call MakeDir(App.Path & "\bak") '创建备份目录
End If
FileCopy FLNSTR, App.Path & "\bak\" & DATESTR & ".txt"
FileCopy FLNSTR, App.Path & "\data\data.txt"
'---------------- 开始文本转换
Dim connk As New Connection
connk.Open connstring
Dim Cmd3 As New ADODB.Command
Dim rs3 As New ADODB.Recordset
Set Cmd3.ActiveConnection = connk
Cmd3.CommandType = adCmdStoredProc
Cmd3.CommandTimeout = 1000
Cmd3.CommandText = "intxt_data"
Set rs3 = Cmd3.Execute(numrec)
If numrec = 0 Then
MsgBox "读取失败!请联系程序员."
Else
Screen.MousePointer = 1
MDIFormwb.Caption = "Wb"
End If
Else
MsgBox "没有读卡钟数。", vbOKOnly
Screen.MousePointer = 1
MDIFormwb.Caption = "Wb"
Unload Frmflash
Exit Sub
End If
' Set rs3 = Nothing
Unload Frmflash
If connk.State Then connk.Close
If rs3.State Then rs3.Close
Set Cmd3 = Nothing
Exit Sub
err:
Screen.MousePointer = 1
Unload Frmflash
MsgBox "读取数据失败!请重试.", vbCritical, "错误!"