Run-time error: SQL Server does not exist or access denied

M

Matthew Louden

I attempt to connect ASP.NET application with SQL Server using ADO.NET. I
just open a connection, and it had run-time error in line 34: cn.open():


SQL Server does not exist or access denied.
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: SQL Server does not
exist or access denied.

Source Error:

Line 32: Dim connectionString As String = "Data Source=(local);
Initial Catalog=mydatabase"
Line 33: Dim cn As New SqlConnection(connectionString)
Line 34: cn.Open()
Line 35: Response.Write(cn.ConnectionString & "," &
txtBoxUserName.Text)
Line 36: 'Debug.WriteLine(cn.ConnectionString)


any ideas?? Thanks!
 
G

Greg Low \(MVP\)

Hi Matthew,

You need to provide details of how you are going to be authenticated in the
connection string. Either a sql server username & password or a value like
"Trusted_Connection=yes".

HTH,
 
G

Gaurav Vaish

Two possibilities:

1. SQL Server is not running.
2. The connection string has some problems. You may like to do add
username / password, or opt for a trusted connection.



Cheers,
Gaurav
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top