Wednesday, August 11, 2010

How to edit values in a database by using gridview?

hi...i m using datagrid and sqldatasource to display data in the gridview..i m trying to edit data in database by using datagrid...i also specified the update and delete command in sqldatasource but its still not workin plzzz.....of anyone has been in sucessfull in doing this then plzz reply in detailHow to edit values in a database by using gridview?
First of all, is your DataGridView bounded to the datasource. If not, you should bind it.(I assume you know how). But if it is still not working, there is a simple way I always use:





I think you have a dataset already(If not, create it). Show the dataset in Visual Studio.(right click%26gt;edit with designer) It shows the tables and relations. Right click on the table you want to add SQL command to it and select add%26gt;query. Then instead of SQL command, select ';create stored procedure';.


Now you can save any query you want as a stored procedure and give it a name. Then, whenever you want to use that query, just call the stored procedure and give its arguments. Voila! it will work.





Good luck.


If you still have problems, feel free to contact me to give you more details.

No comments:

Post a Comment