Hi, Barry.
The issue you're seeing is that your database server doesn't
have a user named "JACKSON-QS7MHO6H\ASPNET"
with permissions to access the pubs database.
Since you're not specifying a username in your connection string,
the ASP.NET user is the one which attempts to login...and fails.
Add a user named "JACKSON-QS7MHO6H\ASPNET"
( that's "YourMachineName\ASPNET" ) to either SQL Server
or MSDE ( whichever you're using ) and give it permissions to
access the pubs database.
Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================
"Barry" <so*****@hello.com> wrote in message
news:e%****************@TK2MSFTNGP12.phx.gbl...
Hi
When trying to connect to SQL Server using the code below i get this message
at myConnection.Open() line
Login failed for user 'JACKSON-QS7MHO6H\ASPNET'
from where does it add \ASPNET
how do i log on
string mySelectQuery = "SELECT * FROM authors";
string myConnectString = "Persist Security Info=False;Integrated
Security=SSPI;database=pubs;server=JACKSON-QS7MHO6H;";
SqlCommand myCommand = new SqlCommand(mySelectQuery);
myCommand.Connection = new SqlConnection(myConnectString);
SqlConnection myConnection = new SqlConnection(myConnectString);
myCommand.CommandTimeout = 15;
myCommand.CommandType = CommandType.Text;
myConnection.Open();
Barry