How to Delete and Retrieve Data in C# and SQL Server 2005

0
138

deleteandretrieveSQLOPIThis time, I will teach you how to delete and retrieve the data in C#.net and SQL server 2005. Deleting records are not advisable to a system, however, in developing a system, you have to put a “delete” method so that, it will be easy for you to remove whatever data that you have saved in the database for the input testing.

 

So, let’s get started:

 

  • Create a database and name it “testdb”.
  • Open Microsoft Visual Studio 2008 and create new Windows Form Application.
  • Do the Form as follows.

deleteandretrieveSQLFig.1

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

deleteandretrieveSQLFig.2

  • Declare all the classes and variable that are needed.

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

  • Go back to the design view, double-click the Form and do the following codes for the connection between C# and SQL server.
  • Create a method for retrieving the records in the database to the DataGridView.
  • Go back to the design view, double-click a button and do the following codes for deleting the records in the SQL database.
 

Output:

deleteandretrieveSQLOPI

 

For all students who need a programmer for your thesis system or anyone who needs a source code 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