Updating Data in C# and SQL Server

0
53

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.

updatingSQLfig.1

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

updatingSQLfig.2

  • 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.

updatingSQLfig.3

  • 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.
 

Output:

 

updatingSQLPIoutput

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

Facebook Comments

LEAVE A REPLY

Please enter your comment!
Please enter your name here