错在哪里?
Public Function InsertLogData(ByVal dstLogUser As Logdata) As Boolean
dsCommand.InsertCommand = GetInsertCommand()
dsCommand.Update(dstLogUser, Logdata.log_table)
If dstLogUser.HasErrors Then
dstLogUser.Tables(Logdata.log_table).GetErrors()
Else
dstLogUser.AcceptChanges()
InsertLogData = True
End If
End Function
Private Function GetInsertCommand() As OleDb.OleDbCommand
Dim conn As OleDb.OleDbConnection = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\UserLog.mdb")
If insertCommand Is Nothing Then
insertCommand = New OleDb.OleDbCommand("INSERT INTO Log (Usercode,Password,Username) VALUES (code_PARM,pwd_PARM,NAME_PARM)", conn)
insertCommand.CommandType = CommandType.Text
With insertCommand.Parameters
.Add(New OleDb.OleDbParameter(code_PARM, OleDb.OleDbType.Char, 50))
.Add(New OleDb.OleDbParameter(NAME_PARM, OleDb.OleDbType.Char, 50))
.Add(New OleDb.OleDbParameter(pwd_PARM, OleDb.OleDbType.Char, 50))
.Item(code_PARM).SourceColumn = Logdata.code_FIELD
.Item(NAME_PARM).SourceColumn = Logdata.name_FIELD
.Item(pwd_PARM).SourceColumn = Logdata.pwd_FIELD
End With
End If
GetInsertCommand = insertCommand
End Function