txt文件如何批量导入access?
1个回答
2013-06-13
展开全部
给你段代码参考一下:
Dim strSQL, strLine As String
Dim tmpS() As String
Dim FileNumber As Integer
If Dir(App.Path & "\setuplist.ini") = "" Then
gSQLServer = ""
gDataBase = ""
gLogin = ""
gPassword = ""
Exit Sub
End If
FileNumber = FreeFile
Open App.Path & "\setuplist.Ini" For Input As #FileNumber
Do While Not EOF(FileNumber)
Line Input #FileNumber, strLine
tmpS = Split(strLine, "=")
Select Case UCase(Trim(tmpS(0)))
Case "SQL SERVER"
gSQLServer = Trim(tmpS(1))
Case "DATABASE"
gDataBase = Trim(tmpS(1))
Case "LOGIN"
gLogin = Trim(tmpS(1))
Case "PASSWORD"
gPassword = Trim(tmpS(1))
End Select
Loop
Close #FileNumber
Dim strSQL, strLine As String
Dim tmpS() As String
Dim FileNumber As Integer
If Dir(App.Path & "\setuplist.ini") = "" Then
gSQLServer = ""
gDataBase = ""
gLogin = ""
gPassword = ""
Exit Sub
End If
FileNumber = FreeFile
Open App.Path & "\setuplist.Ini" For Input As #FileNumber
Do While Not EOF(FileNumber)
Line Input #FileNumber, strLine
tmpS = Split(strLine, "=")
Select Case UCase(Trim(tmpS(0)))
Case "SQL SERVER"
gSQLServer = Trim(tmpS(1))
Case "DATABASE"
gDataBase = Trim(tmpS(1))
Case "LOGIN"
gLogin = Trim(tmpS(1))
Case "PASSWORD"
gPassword = Trim(tmpS(1))
End Select
Loop
Close #FileNumber
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询