0

Hi Everyone I need a syntax for update statement LIke this:

cmd.CommandText = "UPDATE tab(tab_id,tab_name) SET tab_name=@tname WHERE tab_id=@tab_id";

this one aint working ,Somebody please help.

I have two textboxes tab_id,tab_name

I have to Update tab_name based on tab_id,...when i Click content of datagridview then I will get the content into textboxes like tab_id ,tab_name will be drawn from the grid to the textboxes.

If I change the values from tab_name and click update button it should update both grid as well as underlying database.

Thanks In advance.

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by Geekitygeek
0

Hi Everyone I need a syntax for update statement LIke this:

cmd.CommandText = "UPDATE tab(tab_id,tab_name) SET tab_name=@tname WHERE tab_id=@tab_id";

this one aint working ,Somebody please help.

I have two textboxes tab_id,tab_name

I have to Update tab_name based on tab_id,...when i Click content of datagridview then I will get the content into textboxes like tab_id ,tab_name will be drawn from the grid to the textboxes.

If I change the values from tab_name and click update button it should update both grid as well as underlying database.

Thanks In advance.

0

Firstly, please don't bump your threads...especially with duplicate posts.
Secondly, if you are ever unsure of sql syntax there are great references online such as W3CSchools.
You'll see in the link that the syntax you need is "UPDATE tablename SET column1 = @value1 WHERE column2 = @value2".
Correct your update statement and let us know if you still have problems

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.