Click here to Skip to main content
15,890,690 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Dear All, I got Error Near the line.
C#

Posted
Updated 1-Dec-11 19:55pm
v3
Comments
[no name] 2-Dec-11 0:37am    
EDIT: added "pre" tag
[no name] 2-Dec-11 0:37am    
Hi, can you give us the exact error you are getting?
sriman.ch 2-Dec-11 0:41am    
What the error you got? What we have to understand from this code posting ? Please be more specific .....
2011999 2-Dec-11 0:44am    
Con't find table 0(zero)

Hi,

To my knowledge what I understood is that the query doesnt return any data then the dataset ds will contain no table. Then in that case if you are trying to assign ds.Tables[0] to gridview then it will throw you an error

try as follows

C#
if(ds.Tables.count>0)
{
if(ds.Tables[0]!=null)
{
grdView.DataSource = ds.Tables[0];
grdView.DataBind();
}
}
 
Share this answer
 
simply try this

GridView1.DataSource = ds;
GridView1.DataBind();


go thru this link
Click
 
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