如何编程将txt文本文件中的内容读入到sql数据库中
Private Sub Command1_Click()Dim rs As New ADODB.Recordset
' Dim cmd1 As New ADODB.Command
Dim cmd2 As New ADODB.Command
Dim str1 As String, str2() As String
Call contooledb
'Set cmd1.ActiveConnection = sqlcon
'cmd1.CommandText = "Create Table txt(id char(10),nr char(10))"
'cmd1.Execute
Set cmd2.ActiveConnection = sqlcon
cmd2.CommandText = "select * from txt"
Set rs = cmd2.Execute
Open "D:\1.txt" For Input As #1
Do While Not EOF(1)
Line Input #1, str1
rs.AddNew
str2 = Split(str1, vbTab)
'For i = 0 To UBound(str2)
rs(0) = str2(0)
rs(1) = str2(1)
'Next i
rs.Update
Loop
rs.Close
sqlcon.Close
End Sub
哪不对???????