我有相关的数据库和网页上传到服务器上,但无法从服务器访问数据库,但通过VS2010在本地计算机上运行时,我能够访问它。 问服务器管理员也关于这个问题,但他们说服务器端一切正常,他们说的代码有问题。无法访问数据库
以下错误我越来越:
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'.
源错误:
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: {
您要连接的数据库在哪里?在你的笔记本上?在运行Web代码的同一个Web服务器上,或在不同的服务器上?你的连接字符串是什么样的? – 2015-02-10 12:52:08