我认为我的 Insert into/ 语法是正确的,但是当我运行项目时总是出现错误...在此代码中,我正在尝试使用 vb2012 将数据添加到我的数据库 ms access 2013 这里的代码...
Private Sub btnadd_Click(sender As Object, e As EventArgs) Handles btnadd.Click
provider = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
dataFile = "C:\Users\hp-2\Documents\Visual Studio 2012\Projects\Delta\Delta.mdb"
connString = provider & dataFile
cnn.ConnectionString = connString
cnn.Open()
cmd.Connection = cnn
addstring = "insert into Transaction (Customer_Name, Job, Trans_date, Amount ) values (" & C_name.Text & ",'" & C_job.Text.Length & "','" & t_date.Text & "','" & t_amount.Text & "');"
cmd = New OleDbCommand(addstring, cnn)
cmd.ExecuteNonQuery()
cnn.Close()
End Sub
这是错误...
An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in System.Data.dll
Additional information: Syntax error in INSERT INTO statement.