Hi, i'm trying to update some data to a table in a access db, but the VB2008 keeps on giving me the same error. I can't see what is wrong because i've used this same code in other form of the project and it worked...
The error I get is: "Syntax error in the UPDATE instruction"
Obs.: The variable 'Code' has a value and it matches with with the table register, so I thin it is not the problem.Code:Dim Actions As String = "" Dim data_atual As DateTime = Today Dim hora_atual As DateTime = TimeOfDay Dim con As OleDbConnection Dim sql As String con = New OleDbConnection("Provider=Microsoft.Jet.oledb.4.0;Data Source=C:\Users\Sbrug\Desktop\db_chamados.mdb;") Dim cmd As OleDbCommand sql = "UPDATE Chamados SET Action='" & Actions & "', HoraClose='" & hora_atual & "', DataClose='" & data_atual & "' WHERE Codigo=" & Code con.Open() cmd = New OleDbCommand(sql, con) Try If cmd.ExecuteNonQuery() Then MsgBox("Dados salvos com sucesso!") Else MsgBox("Falha ao tentar salvar os dados, verifique se existe qualquer anormalidade nos dados inseridos.") End If con.Close() Catch ex As OleDbException MsgBox(ex.Message, MsgBoxStyle.Critical, "Oledb Error") Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "General Error") End Try
Hope you guys can help me....




Reply With Quote