Updating Data in C# and SQL Server

In 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 and create new Windows Form Application.
  • Do the Form as follows.


Writing Basic SQL Select Statements... x
Writing Basic SQL Select Statements With Actual Demonstration | 2020 Best Practices
  • 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

Project Name : Updating Data in C# and SQL Server
Project Platform :C#
Programming Language Used:C# Programming Language
Developer Name :itsourcecode.com
IDE Tool (Recommended):Visual Studio 2019
Project Type :Desktop Application
Database:MySQL Database
Upload Date and Time:June 13, 2016- 5:22am

Leave a Comment