怎么向数据库到不进去东西?账户只有8分了,全给了
刚刚接触VB数据库,有许多东西不懂(账户只有8分了)新编写的程序进行到rs.Open "select from Table1", conn, adOpenStatic, adLockReadOnly出现错误?
哪位高手帮忙解决一下。附件为读取文件和.mdb数据库
程序如下:
3.rar
(10.77 KB)
Private Sub Command1_Click()
Dim intFreeNumber As Integer
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim rsArray() As String, fdArray() As String
Dim i As Long, j As Long
Dim strTemp As String
Dim strfile As String
intFreeNumber = FreeFile()
Open App.Path & "\aa.txt" For Binary As #intFreeNumber
Do While Not EOF(intFreeNumber)
strTemp = Input(intFreeNumber, #intFreeNumber)
strfile = strfile & strTemp
Loop
Close #intFreeNumber
Set conn = New ADODB.Connection
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb;Persist Security Info=False"
conn.Open
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient
rs.Open "select from Table1", conn, adOpenStatic, adLockReadOnly
rsArray = Split(strfile, vbCrLf)
For i = 0 To UBound(rsArray) - 1
fdArray = Split(rsArray(i), ",")
For j = 0 To 1
rs.AddNew
rs(0).Value = Trim(fdArray(0))
rs(1).Value = Trim(fdArray(1))
Next j
Next i
rs.UpdateBatch
Set rs = Nothing
Set conn = Nothing
End Sub