Click here to Skip to main content
16,020,432 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I created temp table and directly calling that through stored procedure and binding it on page load, but i m getting error like ,Date not found on selected data source.

What I have tried:

if (dt.Rows.Count > 0)
{
gridview.datasource = dt;
gridview.databind();
}
else

{
gridview.datasource = dt;
gridview.databind();

}

checking rows whether it returns anything or not
Posted
Updated 14-Mar-17 21:00pm
v6
Comments
CHill60 14-Mar-17 8:01am    
You have nothing called "Date" - share with us what the actual error message actually says
Mahesh2223 14-Mar-17 8:04am    
sorry it is TransDate
Mahesh2223 14-Mar-17 8:05am    
A field or property with the name 'TransDate' was not found on the selected data source.
CHill60 14-Mar-17 8:08am    
I can see where you create a temporary table in the Stored Procedure but you have not included the part of the SP where you actually return any data
CHill60 14-Mar-17 8:14am    
Well that seems ok. Are you sure you've set up the correct datasource on the DataGrid?

1 solution

Select @DaysCount= count(distinct([Transdate]))



put bracet on trandate and try it
 
Share this answer
 
Comments
Mahesh2223 15-Mar-17 1:32am    
No its not working
Rahul Choudhary 15-Mar-17 6:13am    
use count(distinct([Transdate])) as [TransDate]

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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