Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
There should be more error message provided. Can you log in via SQL Server Management Studio? –  mrdenny Mar 11 '11 at 7:36
Have you enabled remote connections on the database? Check here to ensure that you have covered everything off (including firewall). –  nimizen Mar 11 '11 at 13:31
This is also a good resource that goes through the common gotcha's! –  nimizen Mar 11 '11 at 13:38
Also, make sure you've added xaa9-PC\xaa9 as a user in the test databae with appropriate permissions to be able to read from tblCustomers. –  squillman Mar 11 '11 at 14:14
Yes, I can login via Management Studio Windows Authentication at source localhost\SQLEXPRESS and Username xaa9-PC\xaa9 –  user34683 Mar 11 '11 at 16:54
show 2 more comments

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.