我正在开发一个小项目,我必须使用访问数据库。 我有一个很大的问题,“INSERT INTO”语句,并花了很多小时寻找解决方案后再次。 这是部分代码:oledb“INSERT INTO”语句错误
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Try
connexion.Open()
Dim cmdString_update As String = "INSERT INTO notes (nom, note) VALUES (@nom, @note)"
Dim SQLCommand3 As New OleDbCommand(cmdString_update, connexion)
SQLCommand3.Parameters.AddWithValue("@nom", nom)
SQLCommand3.Parameters.AddWithValue("@note", note)
'SQLCommand3.Parameters.AddWithValue("@commentaire", commentaire)
SQLCommand3.ExecuteNonQuery()
Catch ex As OleDbException
' Display error
MsgBox("Error: " & ex.ToString())
Finally
' Close Connection
connexion.Close()
MsgBox("Connection Closed")
End Try
End Sub
这是错误的截图:H ttps://docs.google.com/file/d/0B3v4Tp1x6sfDMWFEQTJUbUVTTUE/edit?usp=sharing
你能帮助我吗?这让我非常非常疯狂!
非常感谢,抱歉我的英文不好。
(我编程VB.NET与Visual Studio Express的2012年)
嗯......很抱歉Andy。 –