Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
246 views
in Technique[技术] by (71.8m points)

sql server - What is the sql connection string I need to use to access localhostSQLEXPRESS with Windows Authentication or SQL Authentication?

'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=localhostSQLEXPRESS;Initial Catalog=test;User Id=xaa9-PCxaa9;Password=abcd;"

Error Message:

Query is select * from tblCustomers where username='johndoe' error is Login failed for user 'x309-PCx309'.

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-PCx309'.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Try using Windows authentication:

Data Source=localhostSQLEXPRESS;Initial Catalog=test;Integrated Security=SSPI;

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...