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();


Sunny SharmaRank #223 · 11.1K reputationPosted Jul 23, 2013, 3:55 AM EDT
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!
mohammed shamsheerRank #4,152 · 361 reputationPosted Jul 23, 2013, 4:20 AM EDT
Sunny SharmaRank #223 · 11.1K reputationPosted Jul 23, 2013, 4:23 AM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 23, 2013, 4:23 AM EDT
Execute this SP displayDetails directly and check the result
Regards,
Iftikar
Sunny SharmaRank #223 · 11.1K reputationPosted Jul 23, 2013, 4:29 AM EDT
Thanks for replying to the question but I think that's a method rather than being an Stored Procedure. What say?
Jignesh TrivediRank #16 · 50.3K reputationPosted Jul 23, 2013, 7:07 PM EDT
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.
mohammed shamsheerRank #4,152 · 361 reputationPosted Jul 23, 2013, 9:48 PM EDT
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