this is my display function it shows error Cannot find table 0.
public void display()
{
DataSet ds = new DataSet();
ds = DB.ExecuteQuery_SP("displayDetails");
GridView1.DataSource = ds.Tables[0];
GridView1.DataBind();
protected void btnSave_Click(object sender, EventArgs e)
{
ThreadStart DisplayThread = new ThreadStart(display);
Thread t2 = new Thread(DisplayThread);
t2.Start();
display();
ThreadStart InsertionThread = new ThreadStart(insertion);
Thread t1 = new Thread(InsertionThread);
t1.Priority = ThreadPriority.Highest;
t1.Start();
//insertion();
ThreadStart MailThread = new ThreadStart(Mail);
Thread t3 = new Thread(MailThread);
t3.Start();
//Mail();
display();
DataSet ds = new DataSet();
ds = DB.ExecuteQuery_SP("displayDetails");
GridView1.DataSource = ds.Tables[0];
GridView1.DataBind();
7 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.

mohammed shamsheerPosted Jul 24, 2013, 1:48 AM
display()
{
try
{
DataSet ds = new DataSet();
ds = DB.ExecuteQuery_SP("displayDetails");
GridView1.DataSource = ds.Tables[0];
GridView1.DataBind();
}
catch(exception ex)
}
i used try catch block then the problem solved
Thanks for all ur answers
Jignesh TrivediPosted Jul 23, 2013, 11:07 PM
hi,
I think, your dataset soes not have any table and there for it cannot find table in position 0.
so first of all check whether your dataset contain any table or not?
also can please share code for DB.ExecuteQuery_SP method?
hope this will help you.
Sunny SharmaPosted Jul 23, 2013, 8:29 AM
Thanks for replying to the question but I think that's a method rather than being an Stored Procedure. What say?
Iftikar HussainPosted Jul 23, 2013, 8:23 AM
Execute this SP displayDetails directly and check the result
Regards,
Iftikar
Sunny SharmaPosted Jul 23, 2013, 8:23 AM
mohammed shamsheerPosted Jul 23, 2013, 8:20 AM
Sunny SharmaPosted Jul 23, 2013, 7:55 AM
I suspect this line of code is returning a dataset:
DB.ExecuteQuery_SP("displayDetails");
I suggest you to put a breakpoint on this line inside your display method and checj if it's working properly.
Hope it helps.
Cheers!