Click here to Skip to main content
15,921,606 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi..

Am using Two Columns in Gridview .

First Column to Display the List of Students in the Tables for this i used SQL query/

In the Second Column i need to Display the no of records using "SELECT COUNT(*) FROM table_name"

How to add the second column with another sql query ????
Posted
Comments
ZurdoDev 26-Mar-12 11:35am    
What is the count of?
rajsekar g 26-Mar-12 11:48am    
No of records in table !!
ZurdoDev 26-Mar-12 11:50am    
Total? If so, just do a single query. SELECT StudentName, (SELECT COUNT(*) FROM Students) AS TotalCount FROM Students
Kschuler 26-Mar-12 11:49am    
Chances are you won't need a second SQL, you'll just need to rework the one you have. Can you post what you have so far and give us more information about the count you are trying to add? Use the Improve Question button to add more info for us.

1 solution

use sub query and bind the gridview with the single datasource with this query

select st_name,(select count(*) from student where condition) as count-st from student
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900