C#: Calculate the Total Quantity of Books Based on DataGridview with SQL Server

1
177

CountDTGSQLfig.3

Manually counting of books in bookshelves may take you hours before you count it all. Worst, you might be forgetful and you need to start counting again all the books from the start. But, now you have nothing to worry about because this simple automated method will help you out. This method will be the one to calculate the quantity of books that are available. All you have to do is fill out the book names and author in the database and once you clicked the “calculate” button the total number of books will be calculated and displayed in the dataGridview.

 

Let’s Begin:

 

1. Create a database in the SQL server 2005 Express Edition and name it “dbbooks“.

2. Create a table in the database that you have created.

3. Open Microsoft Visual Studio 2008 and create a new Windows Form Application for C#. Then, do the form just like this.

CountDTGSQLfig.1

4. Go to the solution explorer, click the “code view” to fire the code editor.

CountDTGSQLfig.2

5. Initialize the classes and declare the variables that you’re going to use.

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

6. Create a method to display the data in the dataGridview from SQL Server database.
7. Set up the connection between SQL server and C#.net. Then, call a method that you have created in the fist load of the form.
8. Go back to the design view, double-click the “Calculate” button and do the following codes for calculating the total quantity of books.

Output:

CountDTGSQLfig.3

 

For all students who need a programmer for your thesis system or anyone who needs a source code in any a programming languages. You can contact me @ :

 

 

Email – [email protected]
Mobile No. – 09305235027 – TNT

 

Download Source code

Facebook Comments

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here