connect()
MD = "update EmpRec set ('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "', '" & TextBox4.Text & "', '" & TextBox5.Text & "','" & ComboBox2.Text & "','" & ComboBox3.Text & "','" & Label3.Text & "','" & ComboBox4.Text & "','" & ComboBox5.Text & "','" & TextBox7.Text & "','" & TextBox8.Text & "','" & TextBox9.Text & "','" & Label19.Text & "','" & Label22.Text & "','" & Label25.Text & "','" & TextBox6.Text & "','" & TextBox10.Text & "')"
comm = New OleDbCommand(MD, conn)
comm.ExecuteNonQuery()
MsgBox("Done!", MsgBoxStyle.Information)
grid()
TextBox1.Clear()
TextBox2.Clear()
TextBox3.Clear()
TextBox4.Clear()
TextBox5.Clear()
DataGridView1.Refresh()
TextBox2.Enabled = False
TextBox3.Enabled = False
TextBox4.Enabled = False
TextBox5.Enabled = False
End Sub
答案 0 :(得分:0)
这不是编写UPDATE语句的方法。
试着看看MD的样子。它可能类似于update EmpRec set ('asdf','zxcv','qwer'...
列名称在哪里?此外,正如Alex K.在评论中写道,你真的需要将其更改为参数化查询。