Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 22nd, 2004, 03:31 AM
a42 a42 is offline
Registered User
 
Join Date: Nov 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Sql Server Login Failed error

Hello

I am trying to connect to a sql server database, and I keep getting errors when trying to log in.

Here is my connection string:

Dim strConnection as String ="Initial Catalog=dsnName;UID=userID;Password=xxx;DATABASE=N orthwind;" />

The code I am using is straight from the Beginning ASP.NET Databases book and works fine on my localhost:

Code:
Dim objConnection As New SqlConnection(strConnection)
  Dim strSQL As String = "SELECT FirstName, LastName, Country " & _
                         "FROM Employees;"
  Dim objCommand As New SqlCommand(strSQL, objConnection)
  objConnection.Open()
  Response.Write("ServerVersion: " & objConnection.ServerVersion & _
                 vbCRLF & "Datasource: " & objConnection.DataSource & _
                 vbCRLF & "Database: " & objConnection.Database)

  dgNameList.DataSource = objCommand.ExecuteReader()
  dgNameList.DataBind()
  objConnection.Close()
I keep getting a 'Login failed for user' exception, although it DID work initially for some reason (a couple of days) and then I began to receive an error. This user account was set up by the network admin. to allow access on an academic server. He set up the account and pw, and orginally we had an error of "Login failed for user 'NT AUTHORITY\LOCAL SERVICE,'" but he switched authentication mode to Mixed and now we have a general login failed error. (Using classic asp we are able to connect fine.) Any other suggestions would be very appreciated.

Thank You
 
Old November 22nd, 2004, 09:14 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Did you create the DSN on the server?

 
Old November 22nd, 2004, 06:43 PM
a42 a42 is offline
Registered User
 
Join Date: Nov 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by stu9820
 Did you create the DSN on the server?

Yes, he set everything up for us, and the connection works fine in classic ASP, just not in .NET.

 
Old December 14th, 2004, 05:19 PM
Wap Wap is offline
Registered User
 
Join Date: Dec 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Wap
Default


Try using Integrated Security=SSPI instead of UID and PWD.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chat Server: Login failed. jtsroberts BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 3 March 19th, 2008 06:45 AM
Crystal Report "Login Failed" windows 2000 server HaniShtine Crystal Reports 0 December 7th, 2005 04:00 PM
SQL Server error 4060 - Login fails Sksdb SQL Server 2000 0 January 18th, 2005 07:02 AM
SQL Server / Login failed for user 'NT AUTHORITY ElPato ASP.NET 1.0 and 1.1 Basics 2 November 14th, 2004 10:03 AM
sql server login failed rizp SQL Server 2000 10 September 11th, 2004 03:01 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.