Click here to Skip to main content
15,884,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi i have made an web application asp.net


Sometime when i open the application which is hosted on the server
and i try to login i get the error message
Cannot find table 0.


Again when i refresh the login page and again try to log in i don't receive that error



same error is coming in the another error can u tell me what might be the problem

When i run the application on the local host it is running fine
Posted
Comments
CodeBlack 22-Aug-13 7:33am    
can you please improve your question with code sample and show where exactly you are getting error ?
Nandakishore G N 22-Aug-13 8:36am    
please paste the code what have you done so far?

and i try to login i get the error message
Cannot find table 0.


You're not getting any data in the dataset.
Check the table for records. If records exists then make sure records exists for login user.
 
Share this answer
 
Comments
rocky_em 22-Aug-13 7:54am    
yes there are records in that table
C#
Hi Rocky
          Cannot find table 0.is error occurs becouse ur dataset or datatables does'nt have any value at that time.
         I think ur database has some problem ...i think u get value from database in to dataset and then you provide the value to some variable like

 ds is datasetname

 cmd=da.fill(ds);
int a=ds.tables[0].rows[0]["ID"].tostring();

use 

if(ds.tables[0].rows.count !=0)
{
int a=ds.tables[0].rows[0]["ID"].tostring();
}
else
{
//print message
}
you see here in your dataset or datatable no rows found ...check it


it helps you...select as answer..
 
Share this answer
 
v2
Comments
rocky_em 22-Aug-13 7:55am    
heok i will try this now :)
rocky_em 22-Aug-13 8:12am    
Hey i have changed the code
like this if (ds.Tables[0].Rows.Count != 0)
{
#region
lblMessage.Text += "ds.tables[0].rows.count";
intEmpId = Convert.ToString(ds.Tables[0].Rows[0]["usrEmployeeCode"].ToString());
Session["EmpId"] = Convert.ToString(ds.Tables[0].Rows[0]["usrEmployeeCode"].ToString());
Session["EmpName"] = ds.Tables[0].Rows[0]["UserName"].ToString();
Session["EmpCode"] = ds.Tables[0].Rows[0]["usrEmployeeCode"].ToString();
Session["Role"] = ds.Tables[0].Rows[0]["Role"].ToString();
#endregion
}
else
{
lblMessage.Visible = true;
lblMessage.Text+= "DataCounlnot be retrived from the database";
}

Still the same error is coming
Cannot find table 0 as soon as i refreshed the login page and then again login
then i am not receving any error

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