我遇到的問題是從ASP.NET應用程序連接到我的SQL Server(2005)上的帳戶。通過字符串連接到SQL服務器時出錯,無法識別用戶名或密碼
我曾嘗試使用默認的sa登錄和用戶ive已創建的SQL管理工作室的設置已設置爲混合屬性,我有在webconfig中的字符串連接,以及也不起作用。
C#代碼
//string conStr = ConfigurationManager.ConnectionStrings["SQLConnectionString"].ConnectionString;
string conStr = @"server=JAMES-PC\SQLEXPRESS; database=projectDB; uid=james; password=password;";
string query = "SELECT [TaskID], [Task], [Start Date] AS Start_Date, [End Date] AS End_Date, [Priority], [Time Allowance] AS Time_Allowance, [Details], [Catagory] FROM [schedulerData0]";
SqlDataAdapter dataAdapt = new SqlDataAdapter(query, conStr);
DataTable table = new DataTable();
dataAdapt.Fill(table);
GridView1.DataSource = table;
GridView1.DataBind();
我收到的錯誤消息是:
用戶登錄失敗 '詹姆斯'。用戶未與可信的SQL Server連接相關聯。
任何幫助表示讚賞 詹姆斯
也許你需要IntegratedSecurity = SSPI? – 2013-02-13 13:47:13
當您使用SQL帳戶時,將IntegratedSecurity = false設置爲 – 2013-02-13 13:48:23
此代碼將在webconfig中的位置?或管理工作室內的某處 – 2013-02-13 14:10:21