Hi everyone!
I am trying to update a few fields with data. In an MS ACCESS db.
I'm sure I have the syntax of the UPDATE command wrong. Can someone PLEASE tell me what I am doing wrong?
Here's the code.
Code:Public Sub SaveDB() ' This Function Saves the config into the database Dim databaseName As String = Application.StartupPath & "\CONFIG.DAT" Dim ServerName, NetID As String ServerName = frmConfig.txtServerName.Text NetID = frmConfig.txtNetID.Text Dim constring As String = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source =" & databaseName Using myconnection As New OleDbConnection(constring) myconnection.Open() Dim sqlQry As String = "UPDATE SystemData SET ServerName = '" & frmConfig.txtServerName.Text & "', ServerID = '" & frmConfig.txtNetID.Text & '" & WHERE configid=1;'" Using cmd As New OleDbCommand(sqlQry, myconnection) cmd.Parameters.AddWithValue("@ServerName", ServerName) cmd.Parameters.AddWithValue("@NetID", NetID) cmd.ExecuteNonQuery() End Using End Using End Sub




Reply With Quote
