473,396 Members | 2,014 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,396 software developers and data experts.

Logon Failed connecting to SQL Server

I've gone throught the MSDN walkthrough "Creating a Web Application Using
Visual C# or Visual Basic". When I run the sample I get "Login failed for
user 'dbuser'" at the line with "SqlDataAdapter1.Fill(dSet)". The SQL server
is setup for mixed mode and I have a login in Enterprise Manager for the
dbuser account. I've setup a system DSN in ODBC on the client which tested
succesfully. In Visual Studio 2003 I've chosen "Preview Data..." for the
SqlDataAdapter1, which successfully fills the dataset. I don't understand why
those two methods can access the database, but the aspx page doesn't. I've
triple checked the username and password for each method. Is there something
I've overlooked? I'm attempting this while logged in as the local admin on
the client computer instead of as a domain account, but I wouldn't think this
would make a difference since it's a SQL server login and the other two
methods work under this login. Any help would be appreciated.
Nov 19 '05 #1
14 3335
Show your connection string.

Eliyahu

"David Tilman" <Da*********@discussions.microsoft.com> wrote in message
news:A3**********************************@microsof t.com...
I've gone throught the MSDN walkthrough "Creating a Web Application Using
Visual C# or Visual Basic". When I run the sample I get "Login failed for
user 'dbuser'" at the line with "SqlDataAdapter1.Fill(dSet)". The SQL server is setup for mixed mode and I have a login in Enterprise Manager for the
dbuser account. I've setup a system DSN in ODBC on the client which tested
succesfully. In Visual Studio 2003 I've chosen "Preview Data..." for the
SqlDataAdapter1, which successfully fills the dataset. I don't understand why those two methods can access the database, but the aspx page doesn't. I've
triple checked the username and password for each method. Is there something I've overlooked? I'm attempting this while logged in as the local admin on
the client computer instead of as a domain account, but I wouldn't think this would make a difference since it's a SQL server login and the other two
methods work under this login. Any help would be appreciated.

Nov 19 '05 #2
Your Sql Server is probably set to use Windows Authentication and not
Mixed Mode.
if you are running MSDE then try the following.
MSDE 2000 (without Enterprise Manage)
Start -> Run -> regedit ->
HKLM/Software/Microsoft/MSSQLServer/MSSQLServer/LoginMode
The value will be 1 and needs to be changed to 2.

for SQL Server with Enterprirse Manager
SQL Server 2000 (using Enterprise Manager)
· Open The SQL Server Enterprise Manager
Start menu > Programs > Microsoft SQL Server > Enterprise Manager)
· Expand the tree-control until you can your server
· Right click on the server name and "SQL Server Properties
(Configure)" window will open
· Select the Security tab
· For "Authentication", select "SQL Server and Windows"

Nov 19 '05 #3
I'm Using SQL Server 2000, not MSDE and it is setup for mixed mode. If it
wasn't mixed mode, I think the ODBC or "show date" in VS would have failed,
but I could be wrong. The "dbuser" acount was created in Enterprise Manager,
not Active Directory.
"re****@community.nospam" wrote:
Your Sql Server is probably set to use Windows Authentication and not
Mixed Mode.
if you are running MSDE then try the following.
MSDE 2000 (without Enterprise Manage)
Start -> Run -> regedit ->
HKLM/Software/Microsoft/MSSQLServer/MSSQLServer/LoginMode
The value will be 1 and needs to be changed to 2.

for SQL Server with Enterprirse Manager
SQL Server 2000 (using Enterprise Manager)
· Open The SQL Server Enterprise Manager
Start menu > Programs > Microsoft SQL Server > Enterprise Manager)
· Expand the tree-control until you can your server
· Right click on the server name and "SQL Server Properties
(Configure)" window will open
· Select the Security tab
· For "Authentication", select "SQL Server and Windows"

Nov 19 '05 #4
So where is the connection string?

Eliyahu

"David Tilman" <Da*********@discussions.microsoft.com> wrote in message
news:7F**********************************@microsof t.com...
I'm Using SQL Server 2000, not MSDE and it is setup for mixed mode. If it
wasn't mixed mode, I think the ODBC or "show date" in VS would have failed, but I could be wrong. The "dbuser" acount was created in Enterprise Manager, not Active Directory.
"re****@community.nospam" wrote:
Your Sql Server is probably set to use Windows Authentication and not
Mixed Mode.
if you are running MSDE then try the following.
MSDE 2000 (without Enterprise Manage)
Start -> Run -> regedit ->
HKLM/Software/Microsoft/MSSQLServer/MSSQLServer/LoginMode
The value will be 1 and needs to be changed to 2.

for SQL Server with Enterprirse Manager
SQL Server 2000 (using Enterprise Manager)
· Open The SQL Server Enterprise Manager
Start menu > Programs > Microsoft SQL Server > Enterprise Manager)
· Expand the tree-control until you can your server
· Right click on the server name and "SQL Server Properties
(Configure)" window will open
· Select the Security tab
· For "Authentication", select "SQL Server and Windows"

Nov 19 '05 #5
Sorry, but I'm at work now and didn't remember to bring the project in with
me from home (I should have done that). I'll be able to respond again in a
few hours with the info. I didn't have to explicitly create a connection
string (I'm not sure if VS did that in the background). I did the walkthrough
step by step from my local MSDN source, but here is the link to the exact
same one online:

http://msdn.microsoft.com/library/de...isualBasic.asp

"Eliyahu Goldin" wrote:
So where is the connection string?

Eliyahu


Nov 19 '05 #6
David Eliyahu was asking for your connectionstring cos that was the only
way he could see the way u were connecting!
But after going through the step u took from MSDN i guess you didn't go
here to:-

http://msdn.microsoft.com/library/de.../en-us/vsintro
7/html/vxwlkusingterminalserverssqlserversonothermachines .asp

Click on the link :-Using SQL Server in Web Applications.
from the page u posted.

Hope that helps
Patrick

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 19 '05 #7
Actually I had missed that. I changed the IIS settings as it stated (cleared
anonymous, Integrated Windows authentication was checked) and edited the
web.config file (already had <authentication mode="Windows" /> and inserted
<identity impersonate="true" />). The problem persists though. I've restarted
the machine and tried running from the local admin account and a domain admin
account with the same results. Could there be anything else I'm missing. Can
any other settings have an effect, whether IIS, DNS, or anything else? I've
been reading through numerous resources that don't hint to other causes.
"Patrick Olurotimi Ige" wrote:
David Eliyahu was asking for your connectionstring cos that was the only
way he could see the way u were connecting!
But after going through the step u took from MSDN i guess you didn't go
here to:-

http://msdn.microsoft.com/library/de.../en-us/vsintro
7/html/vxwlkusingterminalserverssqlserversonothermachines .asp

Click on the link :-Using SQL Server in Web Applications.
from the page u posted.

Hope that helps
Patrick

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 19 '05 #8
Also, the only connectionstring I can see in the project is in web.config:

<sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
cookieless="false"
timeout="20"
/>

Does this connection string need to point to the SQL Server? I thought it
was for simply storing the session info (which would be stored locally).

"Patrick Olurotimi Ige" wrote:
David Eliyahu was asking for your connectionstring cos that was the only
way he could see the way u were connecting!
But after going through the step u took from MSDN i guess you didn't go
here to:-

http://msdn.microsoft.com/library/de.../en-us/vsintro
7/html/vxwlkusingterminalserverssqlserversonothermachines .asp

Click on the link :-Using SQL Server in Web Applications.
from the page u posted.

Hope that helps
Patrick

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 19 '05 #9
No, this connection string has nothing to do with your problem.

You are getting a logon failed message. That is likely because of a problem
with your connection parameters. If you set a breakpoint before Fill
statement and check the connection string, you have a good chance of
spotting the problem straight away.

Eliyahu

"David Tilman" <Da*********@discussions.microsoft.com> wrote in message
news:D4**********************************@microsof t.com...
Also, the only connectionstring I can see in the project is in web.config:

<sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" cookieless="false"
timeout="20"
/>

Does this connection string need to point to the SQL Server? I thought it
was for simply storing the session info (which would be stored locally).

"Patrick Olurotimi Ige" wrote:
David Eliyahu was asking for your connectionstring cos that was the only
way he could see the way u were connecting!
But after going through the step u took from MSDN i guess you didn't go
here to:-

http://msdn.microsoft.com/library/de.../en-us/vsintro
7/html/vxwlkusingterminalserverssqlserversonothermachines .asp

Click on the link :-Using SQL Server in Web Applications.
from the page u posted.

Hope that helps
Patrick

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 19 '05 #10
Sorry, I'm new to ASP programming and datasets. I've set the break at:

SqlDataAdapter1.Fill(dSet)

and looked at the "Locals" watch window. This only provided the info for the
dataset class (dSet). I'm going to have to check the SqlDataAdapter class for
the connection string when I get home from work. I'll post the information at
that time (in about 8 hours).

"Eliyahu Goldin" wrote:
No, this connection string has nothing to do with your problem.

You are getting a logon failed message. That is likely because of a problem
with your connection parameters. If you set a breakpoint before Fill
statement and check the connection string, you have a good chance of
spotting the problem straight away.

Eliyahu


Nov 19 '05 #11
When I stop at the breakpoint for SqlDataAdapter1.Fill(dSet) I show for
SqlDataAdapter1.SelectCommand.Connection.Connectio nString = "workstation
id=DAVID;packet size=4096;user id=dbuser;data source=SERVER2003;persist
security info=False;initial catalog=pubs"

The dbuser is an account setup in Enterprise Manager with read permissions
on all databases. SQL Server is running on SERVER2003. I'm running the IIS
and VS on a computer named DAVID.

"Eliyahu Goldin" wrote:
No, this connection string has nothing to do with your problem.

You are getting a logon failed message. That is likely because of a problem
with your connection parameters. If you set a breakpoint before Fill
statement and check the connection string, you have a good chance of
spotting the problem straight away.

Eliyahu


Nov 19 '05 #12
I thought I would also mention that I decided to test connecting to the SQL
Server by writing a simple VB .NET Windows application. I used this as my
connection string:

Conn = New OdbcConnection("Driver={SQL
Server};Server=SERVER2003;Uid=dbuser;pwd=alaska;Da tabase=pubs;")

and used the OdbcDataReader to successfully query the DB and display the
results to a text box.
"David Tilman" wrote:
When I stop at the breakpoint for SqlDataAdapter1.Fill(dSet) I show for
SqlDataAdapter1.SelectCommand.Connection.Connectio nString = "workstation
id=DAVID;packet size=4096;user id=dbuser;data source=SERVER2003;persist
security info=False;initial catalog=pubs"

The dbuser is an account setup in Enterprise Manager with read permissions
on all databases. SQL Server is running on SERVER2003. I'm running the IIS
and VS on a computer named DAVID.

"Eliyahu Goldin" wrote:
No, this connection string has nothing to do with your problem.

You are getting a logon failed message. That is likely because of a problem
with your connection parameters. If you set a breakpoint before Fill
statement and check the connection string, you have a good chance of
spotting the problem straight away.

Eliyahu

Nov 19 '05 #13
Well, I finally got it to work after more research, but something bothers me
about this. I added this line just before the fill command:

SqlDataAdapter1.SelectCommand.Connection.Connectio nString =
"Server=SERVER2003;Database=pubs;UID=dbuser;PWD=pa ssword"

and it now works. But this is completely different from what the Visual
Studio "Configure Data Adapter" wizard creates for a connection string
("workstation id=DAVID;packet size=4096;user id=dbuser;data
source=SERVER2003;persist security info=False;initial catalog=pubs"). I
entered the proper info in the wizard (user name, password, etc), but the
wizard still didn't create anything useful. What am I overlooking?
Nov 19 '05 #14
There is no password in the connection string created by the wizard. That's
why your login failed. I have never used the wizard ard don't know why it
didn't put the password in.

Eliyahu

"David Tilman" <Da*********@discussions.microsoft.com> wrote in message
news:EA**********************************@microsof t.com...
Well, I finally got it to work after more research, but something bothers me about this. I added this line just before the fill command:

SqlDataAdapter1.SelectCommand.Connection.Connectio nString =
"Server=SERVER2003;Database=pubs;UID=dbuser;PWD=pa ssword"

and it now works. But this is completely different from what the Visual
Studio "Configure Data Adapter" wizard creates for a connection string
("workstation id=DAVID;packet size=4096;user id=dbuser;data
source=SERVER2003;persist security info=False;initial catalog=pubs"). I
entered the proper info in the wizard (user name, password, etc), but the
wizard still didn't create anything useful. What am I overlooking?

Nov 19 '05 #15

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

Similar topics

1
by: Bob Skutnick | last post by:
Help.... I've created an ADO.NET dataset in Visual Studio (a web project). I build the project and then try to create a Crystal Report using the dataset. When I try to use the ADO.NET dataset...
0
by: Max | last post by:
Hi wise people, Has anyone encountered the Crystal Reports problem I describe below? If so, how did you solve it? It seems that every article posted on google regarding CR and logon problems is...
1
by: James | last post by:
Hello group: I guessing there is no way to create an OLEDB linked table in Access to SQL Server, am I correct? Basically, I've currently migrated one of my Access database tables to SQL Server,...
14
by: John J. Hughes II | last post by:
I have "Computer A" which is running Win2K3 and MS SQL server. And "Computer B" which is running a service that I have created. If I change the service on "Computer B" to run as a user my program...
3
by: Maellic | last post by:
Hi, The website I am working on is built with ASP.NET and connects to a SQL Server 2000 database. The web server and database are on the same machine. I have recently tried to modify the timeout...
3
by: Milan Todorovic | last post by:
Hello, I need help. I have experience in ASP.NET programming, but this is my first dealing with Crystal Reports. I'm trying to make the most basic report purely for testing purposes: connect to...
1
by: John Dalberg | last post by:
Running Crystal Reports with the hotfixes and patches & VS 2003. I created a CR report on my development server which has SQL Server. The report runs fine inside Visual Studio. When I switched...
0
by: bonita | last post by:
I come across the error "CrystalDecisions.CrystalReports.Engine.LogOnException: Logon failed." After I move my asp.net code from the development platform (XP professional) to the production web...
3
by: Lee T. Hawkins | last post by:
I am having a number of problems over the last two full days trying to get an ASP.NET 2.0 application to connect to a SQL Server 2005 database... First off, I built this application w/ Visual...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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.