Click here to Skip to main content
15,895,667 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How do I update and delete a record in vb.net?

VB
cmd = New OleDbCommand("update empl set name =" & "'" & TextBox2.Text & "'" & "," & "city = " & "'" & TextBox3.Text & "'" & "," & "cont_no = " & TextBox4.Text & "," & "salary =" & TextBox5.Text & "where no=" & TextBox1.Text & , cn)


using this query I cant update my record and also delete
Posted
Updated 9-Feb-11 1:43am
v4

Make sure you have a record that exists for your no parameter.
Put a debug point in your code on the TextBox1.Text line and see what values come in there.
 
Share this answer
 
Comments
somil030 9-Feb-11 6:34am    
than what type of query performed in Ms Access??
I take it that no and cont_no are fields in table empl and are number types and not a character types. If they were of character type you would need to put quotes around the literals you take from TextBox1 and TextBox2 inside your where clause.

A side note: Please don't piece together your SQL statement like that. Use SQL parameters as they will keep you safe from SQL injection attacks and give you better readability of your SQL statements.

Best Regards,
Manfred
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900