Sir,
I am using the following code in my vb.net while using that code it will show me syntax error.
Private Sub updateinfo()
Dim con As OleDbConnection
Dim cmd As OleDbCommand
Try
con = New OleDbConnection(connectionString)
cmd = New OleDbCommand("UPDATE [Lani] SET [First Name] = '" & txtfirst.Text & "', [Middle Name] = '" & txtmiddle.Text & "', [Last Name] = '" & txtlast.Text & "',[Company Name] = '" & txtcomp.Text & "', [Lani] Rs = '" & txtlani.Text & "',[Date] = '" & DateTimePicker1.Value.Date & "' WHERE [Sr No] = Cint(txtid.text)", con)
cmd.Parameters.AddWithValue("@Sr No", txtid.Text)
cmd.Parameters.AddWithValue("@First Name", txtfirst.Text)
cmd.Parameters.AddWithValue("@Middle Name", txtmiddle.Text)
cmd.Parameters.AddWithValue("@Last Name", txtlast.Text)
cmd.Parameters.AddWithValue("@Company Name", txtcomp.Text)
cmd.Parameters.AddWithValue("@Lani Rs", txtlani.Text)
cmd.Parameters.AddWithValue("@Lani_Date", DateTimePicker1.Value.Date)
con.Open()
'cmd = New OleDbCommand(strupdate, con)
cmd.ExecuteNonQuery()
' Close and Clean up objects
con.Close()
cmd.Dispose()
con.Dispose()
Catch ex As Exception
MsgBox(ex.Message.ToString)
'updateOK = False
End Try
End Sub
End Class
While use this code in the button click event
Please help me.
Thanks in advance