麻烦请看一下这个弱问题
请帮忙看一下这个程序的问题
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim con As OleDb.OleDbConnection
Dim cmd As OleDb.OleDbCommand
Dim dbname As String = "...\db1.mdb "
con = New OleDb.OleDbConnection( "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source= " & dbname)
con.Open()
'2.添加记录
cmd = New OleDb.OleDbCommand( "Insert into student(studentnumber,name) Values( '1111 ', 'jia ') ", con)
cmd.ExecuteNonQuery()
con.Close()
End Sub
access表中,studentnumber是数字型,name是文字型
报错是:
未处理的“System.Data.OleDb.OleDbException”类型的异常出现在 system.data.dll 中。
[解决办法]
Insert into student(studentnumber,name) Values(1111, 'jia ') ", con
[解决办法]
ACCESS中SQL语句有的有点不同
把INTO 去掉看看