我正在使用 Visual Basic 2010 express 来控制 Ms.Access 2007 数据库。我正在努力向数据库添加记录。
我在查询表达式 'ID = 4 中的字符串中出现语法错误
这是我的代码:
If ComboBox1.Text = "" Or TxtJam.Text = "" Or TxtAudio.Text = "" Then
MessageBox.Show("Data belum lengkap", "Error", MessageBoxButtons.OK, messageBoxIcon.Error)
Else
myqry = "UPDATE TblJadwal SET "
myqry = myqry + " Hari = '" & ComboBox1.Text & "',"
myqry = myqry + " Jam = '" & TxtJam.Text & "',"
myqry = myqry + " Audio = '" & TxtAudio.Text & "'"
myqry = myqry + "WHERE "
myqry = myqry + "ID = " & TxtID.Text & "'"
mycmd = New OleDbCommand(myqry, conn)
mycmd.ExecuteNonQuery()
Call Set1()
End If
和我的数据库
ID , autonumber
Hari, text
Jadwal, text
Jam, Text