Click here to Skip to main content
15,913,722 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have database and webpages related to it are uploaded on server but not able to access the database from server but when run on local machine through VS2010 i was able to access it.
Asked Server Admin also about the problem but they told that everything is fine from server side there is problem in code they are saying.

The following error i'm getting:

Server Error in '/' Application.
Invalid object name 'Login'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Invalid object name 'Login'.

Source Error:


Line 20: SqlCommand com = new SqlCommand("select Password from Login where Username='" + Uname_txt.Text.Trim() + "'", con);
Line 21: con.Open();
Line 22: SqlDataReader dr = com.ExecuteReader();
Line 23: try
Line 24: {
Posted
Comments
navin ks 10-Feb-15 1:33am    
connection string problem. Make sure you are using correct connection string

1 solution

Invalid object name 'Login'.
You try to execute a select statement from the table 'Login' (select Password from Login), but from the error it is clear that no such table (view?) exists in your DB...Check it!
 
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