我有相關的數據庫和網頁上傳到服務器上,但無法從服務器訪問數據庫,但通過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