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

  • Thread starter Thread starter Matthew Louden
  • Start date Start date
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!
 
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,
 
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
 
Back
Top