Updating Data in C# and SQL Server


updatingSQLPIoutputIn this tutorial, I will teach you how to update data in the database in C#.Net and SQL Server Manangement Studio Express. With this, you can update data in the database that’s in the DataGridView.


Let’s begin:


  • Create a database and name it “userdb”. Then, insert data depending on your desire.
  • Open Microsoft Visual Studio 2008 and create new Windows Form Application.
  • Do the Form as follows.


  • Go to the Solution Explorer, click the “View Code”  to display the code editor.


  • Declare all the classes and variables that are needed.

Note: Put using System.Data.SqlClient; above the namespace to access sql server library.

  • Create a method for retrieving data in the SQL database to DataGridView.

  • Go back to the design view, double click the Form and do the following codes for calling a method and establishing a connection between SQL server and C#.net.

  • Go back to the design view, click the DataGridView and go to properties. In the properties, select the “Events” just like a lightning symbol and double click the “DoubleClickevent handler.


  • Do the following codes for passing the data in the DataGridView to the TextBoxes.

  • Go back to the design view, double click the button and do the following codes for updating data in the database.





For all students who need programmer for your thesis system or anyone who needs a sourcecode in any programming languages. You can contact me @ :
Email – [email protected]
Mobile No. – 09305235027 – tnt


Download Sourcecode

Looking for more source code? Type your keyword here here!


Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.