I've installed SQL Express on my PC hoping to do some practice creating tables and then modifying them. I coded a webpage in Visual Studio to, basically, SELECT * from a table in the SQLEXPRESS, but I can never get the connection string to work. Please help
My connection string
"Data Source=localhost\SQLEXPRESS;Initial Catalog=test;User Id=xaa9-PC\xaa9;Password=abcd;"
Error Message:
Query is select * from tblCustomers where username='johndoe' error is Login failed for user 'x309-PC\x309'.
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.Exception: Query is select * from tblCustomers where username='johndoe' error is Login failed for user 'x309-PC\x309'.
Source Error:
Line 38: mdbConn.Close() Line 39: Catch ex As Exception Line 40: Throw New Exception("Query is " & strQuery.ToCharArray & " error is " & ex.Message) Line 41: End Try Line 42: End Sub
Source File: E:\CYS\College\Classes\Past Classes\MIS 333K\ASP2\App_Code\DatabaseClass.vb Line: 40
Stack Trace:
[Exception: Query is select * from tblCustomers where username='johndoe' error is Login failed for user 'x309-PC\x309'.] DatabaseClass.SelectQuery(String strQuery) in E:\CYS\College\Classes\Past Classes\MIS 333K\ASP2\App_Code\DatabaseClass.vb:40 DatabaseClass.checkCredential(String strUsername, String strPassword) in E:\CYS\College\Classes\Past Classes\MIS 333K\ASP2\App_Code\DatabaseClass.vb:48 _Default.btnLogin_Click(Object sender, EventArgs e) in E:\CYS\College\Classes\Past Classes\MIS 333K\ASP2\index.aspx.vb:19 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
xaa9-PC\xaa9as a user in thetestdatabae with appropriate permissions to be able to read fromtblCustomers. – squillman Mar 11 '11 at 14:14