update What is the exception message? Let's have a look at
Use VB.net+Access to do a simple program, database read no problem, but the update time is not successful, please ask what is the reason, the code is as follows:
```vb.net
Private Sub ButtonOK_Click(sender As Object, e As EventArgs) Handles ButtonOK.Click
Try
ObjConn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\Resources\DatabaseZuoye.mdb") '链接数据库
ObjConn.Open()
Dim SQLstring As String = "update ZuoyeData set IFFocusOn='是' ,IFRenyuanOK='" & ComboBoxRenyuan.Text & "', IFhuanjingOK='" & ComboBoxHuanjing.Text & "',IFLingbao='" & ComboBoxLingbao.Text & "', FocusList='" & RichTextBoxGuanzhuxiang.Text & "', Quyuzhichiren='" & TextBoxZhichengren.Text & "', Guanzhudu=" & ComboBoxGuanzhudu.Text & " where ID=" & LabelXuhao.Text
'Dim SQLstring As String = "delete from ZuoyeData where ID=" & LabelXuhao.Text
MsgBox(SQLstring)
Dim objComm As New OleDb.OleDbCommand(SQLstring, ObjConn)
objDa.SelectCommand = New OleDbCommand(SQLstring, ObjConn)
objDa.SelectCommand.ExecuteNonQuery()
MsgBox(objDa.SelectCommand.ExecuteNonQuery()) '这里反馈结果还为1,真是奇怪,应该成功了确没有成功
ObjConn.Close()
Catch ex As Exception
MsgBox(ex.Message.ToString)
```
0 Answer
这家伙很懒,什么都没留下...