本文介绍了如何使用oledb命令更新数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只是使用VB 2008的初学者..
我的错误是未处理OleDbException,然后在此msgbox内显示"UPDATE语句中的语法错误".及其突出显示代码com.ExecuteNonQuery()....
I''m just a beginner in using VB 2008..
My error says that OleDbException was unhandled then inside of this msgbox says "Syntax error in UPDATE statement." and its highlight the code com.ExecuteNonQuery()....
Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click
Dim com As New OleDbCommand
com.Connection = con
com.CommandText = "UPDATE Employee set Last_Name='" & txtLastName.Text & "',First_Name='" & _
txtFirstName.Text & "',Middle_Name='" & txtMiddleName.Text & "',Age='" & _
txtAge.Text & "',Position='" & txtPosition.Text & _
"',Address=" & txtAddress.Text & "where Employee_ID=" & cboEmployeeID.Text
com.ExecuteNonQuery()
MsgBox("Record Updated")
Call Md_Settings()
End Sub
推荐答案
Catch Ex as Exception<br />
//....display error contained in Ex here<br />
End Try
编辑您的问题,在此处发布错误,也许有人可以为您提供进一步的帮助.
Edit your question, post the error here and someone might be able to help you further.
这篇关于如何使用oledb命令更新数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!