J
Jonathan Wood
Grrr...
I've spent the last several hours trying to learn ADO.NET. Specifically, the
database connection stuff.
I finally managed to create a database and enter some data within the VS
IDE. I have several ADO.NET books but not one could tell me how to set up my
password.
To make a long story short, I ended up setting up a connection using
(local)\SQLEXPRESS since that's what the only example I could find uses and
I have no idea what to enter for regular MS SQL.
But I didn't have a change to enter a password or anything like that. Based
on another book, I tried all of the following:
string connString = "Data Source=localhost;Initial
Catalog=BlackBeltCoder;Integrated Security=True";
string connString = "Data Source=localhost;Initial
Catalog=BlackBeltCoder;Integrated Security=SSPI";
string connString = "Data Source=localhost;Initial
Catalog=BlackBeltCoder;user id=sa;password=opensesame";
SqlConnection conn = new SqlConnection(connString);
conn.Open();
In each case, the code fails on the call to Open(). Here's the message I
get:
"An error has occurred while establishing a connection to the server. When
connecting to SQL Server 2005, this failure may be caused by the fact that
under the default settings SQL Server does not allow remote connections.
(provider: Named Pipes Provider, error: 40 - Could not open a connection to
SQL Server)"
Well, that's very helpful. I'm not using a remote connection.
I'm running my Web site in the IDE and will still need to figure out how to
connect to the database once I copy the site to my Web hosting account but I
can only deal with so much pain at once.
Is there any help available to figure out how to connect to the database I
have connected?
I've spent the last several hours trying to learn ADO.NET. Specifically, the
database connection stuff.
I finally managed to create a database and enter some data within the VS
IDE. I have several ADO.NET books but not one could tell me how to set up my
password.
To make a long story short, I ended up setting up a connection using
(local)\SQLEXPRESS since that's what the only example I could find uses and
I have no idea what to enter for regular MS SQL.
But I didn't have a change to enter a password or anything like that. Based
on another book, I tried all of the following:
string connString = "Data Source=localhost;Initial
Catalog=BlackBeltCoder;Integrated Security=True";
string connString = "Data Source=localhost;Initial
Catalog=BlackBeltCoder;Integrated Security=SSPI";
string connString = "Data Source=localhost;Initial
Catalog=BlackBeltCoder;user id=sa;password=opensesame";
SqlConnection conn = new SqlConnection(connString);
conn.Open();
In each case, the code fails on the call to Open(). Here's the message I
get:
"An error has occurred while establishing a connection to the server. When
connecting to SQL Server 2005, this failure may be caused by the fact that
under the default settings SQL Server does not allow remote connections.
(provider: Named Pipes Provider, error: 40 - Could not open a connection to
SQL Server)"
Well, that's very helpful. I'm not using a remote connection.
I'm running my Web site in the IDE and will still need to figure out how to
connect to the database once I copy the site to my Web hosting account but I
can only deal with so much pain at once.
Is there any help available to figure out how to connect to the database I
have connected?