Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 cannot connect from asp.net to sql2000

Author  Topic 

ramonred
Starting Member

2 Posts

Posted - 2005-01-16 : 22:03:14
I am following a simple example in a book, connecting to a database and I can't get it to work.

the error:
System.Data.SqlClient.SqlException:,SQL,Server,does,not,exist,or,access,denied.

the code:

private void Page_Load(object sender, System.EventArgs e)
{
SqlConnection myConnection;
myConnection = new SqlConnection(
"server=localhost; database=Northwind; uid=apress; pwd=apress;");
myConnection.Open();
ConnectionState.Text = myConnection.State.ToString();
myConnection.Close();
}


related info:
apress is a user on the Northwind db, as well as 'Computer_Name/ASPNET'

Any help would be greatly appreciated.

Thanks

--------
ramonred

brandonl
Yak Posting Veteran

58 Posts

Posted - 2005-01-16 : 23:15:16
I see it's localhost, so this may not apply:

is the server hidden, or using a different port other than the default? I assume you can connect to Northwind via QA with that un and pw, right?

~BrandonL
Go to Top of Page

ramonred
Starting Member

2 Posts

Posted - 2005-01-17 : 00:56:19
I switched to (local) and it worked fine.

Thanks

--------
ramonred
Go to Top of Page
   

- Advertisement -