473,394 Members | 2,160 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Connect to SQL Server

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

Nov 19 '05 #1
4 1092
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

Nov 19 '05 #2
Barry you need ASPNET account to log into SQL SERVER(thats the ASPNET
WORK PROCESS ASP.NET uses).
Add ASPNET acct to your SQL server.
Hope that helps
Patrick

*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #3
Barry wrote:
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();


Apart from allowing access to the ASPNET account (see
Juan's and Patrick's reply), you may also consider using
authentication and impersonation. This will make your
application run under the account that's logged on, and
if that account has access to your database, it will work.

Search Google for "ASP.NET impersonation".

--

Riki
Nov 19 '05 #4
Thanks all,

I Created a account in SQL Server and that solved the problem

Barry
"Riki" <ri**@nospam.com> wrote in message
news:e7**************@tk2msftngp13.phx.gbl...
Barry wrote:
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();


Apart from allowing access to the ASPNET account (see
Juan's and Patrick's reply), you may also consider using
authentication and impersonation. This will make your
application run under the account that's logged on, and
if that account has access to your database, it will work.

Search Google for "ASP.NET impersonation".

--

Riki

Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Jerry Orr | last post by:
We are trying to determine the easiest (and cheapest) way to get connections for about 50 Win2K workstations on our LAN to DB2 on a z/OS server. We could install DB2 Connect Personal Edition on...
0
by: Zorba.GR | last post by:
IBM DB2 Connect Enterprise Edition v8.2, other IBM DB2 (32 bit, 64 bit) (MULTiOS, Windows, Linux, Solaris), IBM iSoft Commerce Suite Server Enterprise v3.2.01, IBM Tivoli Storage Resource Manager...
5
by: mayamorning123 | last post by:
A comparison among six VSS remote tools including SourceOffSite , SourceAnyWhere, VSS Connect, SourceXT, VSS Remoting, VSS.NET To view the full article, please visit...
14
by: Marcus | last post by:
I have a function that simply returns TRUE if it can connect to a particular Sql Server 2005 express, or FALSE if it cannot. I am getting some strange error codes returned when the computer that...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.