Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 4th, 2004, 11:06 AM
Registered User
 
Join Date: Apr 2004
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default SQL Server / Login failed for user 'NT AUTHORITY

In trying to set up the SQL/Server examples from the Wrox Beginning ASP book I am getting the error below. Originally I recieved errors with the connection strings, but then got that, I think, corrected, or at least changed errors, and now am faced with this one.

Any ideas?

Thanks

---------------------------------------------------------------------

The error occurs on the open method of the connection object, and displays as:

Server Error in '/students' Application.
----------------------------------------------------------------------

ERROR [28000] [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'NT AUTHORITY\LOCAL SERVICE'. ERROR [28000] [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'NT AUTHORITY\LOCAL SERVICE'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.Odbc.OdbcException: ERROR [28000] [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'NT AUTHORITY\LOCAL SERVICE'. ERROR [28000] [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'NT AUTHORITY\LOCAL SERVICE'.



My DSN as setup in the web.config file (password is masked out):



<configuration>
    <system.web>
        <customErrors mode="Off"/>
    <compilation debug="true"/>
        <webServices>
        <protocols>
            <add name="HttpGet"/>
            <add name="HttpPost"/>
        </protocols>
    </webServices>
    </system.web>
  <appSettings>
    <add key="NWind"
         value="Initial Catalog=NWind;UID=StudentSQL;Password=XXXXXXXX;DAT ABASE=Northwind;" />
    <add key="NWindDSN"
    value="DSN=NWind;UID=StudentSQL;PWD=XXXXXXXX;DATAB ASE=Northwind;" />
  </appSettings>
</configuration>
*******

The code (pretty much directly from the Wrox Beginning ASP Databases) is copied below:

<%@ Import namespace="System.Data" %>
<%@ Import namespace="System.Data.Odbc" %>

<html>
  <head></head>
  <body>
    <h4>First Example: Listing data from the Employees table</h4>
    <asp:DataGrid id="dgNameList"
     ... ... ...
     />
  <body>
</html>

<script language="VB" runat="server">
Sub Page_Load(Source As Object, E As EventArgs)
    Dim oODBCConnection As OdbcConnection
    Dim sConnString As String = ConfigurationSettings.AppSettings("NWindDSN")
    oODBCConnection = New OdbcConnection(sConnString)
    oODBCConnection.Open()
    Dim strSQL As String = "SELECT FirstName, LastName, Country " & _
                           "FROM Employees;"
    Dim objCommand As New ODBCCommand(strSQL, oODBCConnection)

   Response.Write("ServerVersion: " & _
             oODBCConnection.ServerVersion & _
             vbCRLF & "Datasource: " & oODBCConnection.DataSource & _
             vbCRLF & "Database: " & oODBCConnection.Database)

   dgNameList.DataSource = objCommand.ExecuteReader()
   dgNameList.DataBind()
   oODBCConnection.Close()
End Sub
</script>


  #2 (permalink)  
Old November 5th, 2004, 02:39 AM
Friend of Wrox
 
Join Date: May 2003
Location: Delhi, Delhi, India.
Posts: 230
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Check your SQL Server authentication properties, it might be in windows authentication only mode. If so try to change that in Mixed mode and run the code again.

Charul Shukla
  #3 (permalink)  
Old November 14th, 2004, 10:03 AM
Authorized User
 
Join Date: Jul 2004
Location: Bandar Seri Begawan, Brunei-Muara, Brunei.
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

>>The code (pretty much directly from the Wrox Beginning ASP Databases) is copied below:

<%@ Import namespace="System.Data" %>
<%@ Import namespace="System.Data.Odbc" %>

<html>
  <head></head>
  <body>
    <h4>First Example: Listing data from the Employees table</h4>
    <asp:DataGrid id="dgNameList"
     ... ... ...
     />
  <body>
</html>

<script language="VB" runat="server">
Sub Page_Load(Source As Object, E As EventArgs)
    Dim oODBCConnection As OdbcConnection
    Dim sConnString As String = ConfigurationSettings.AppSettings("NWindDSN")
    oODBCConnection = New OdbcConnection(sConnString)
    oODBCConnection.Open()
    Dim strSQL As String = "SELECT FirstName, LastName, Country " & _
                           "FROM Employees;"
    Dim objCommand As New ODBCCommand(strSQL, oODBCConnection)

   Response.Write("ServerVersion: " & _
             oODBCConnection.ServerVersion & _
             vbCRLF & "Datasource: " & oODBCConnection.DataSource & _
             vbCRLF & "Database: " & oODBCConnection.Database)

   dgNameList.DataSource = objCommand.ExecuteReader()
   dgNameList.DataBind()
   oODBCConnection.Close()
End Sub
</script>>>>

This code above is working fine, I'm using this as a pattern when I started out. That login failure was in your SQL Server authentication. It could be the user has no permission to access/logon to the northwind database. Try to check properties of your sql server if your using the right authentication method.




jrd
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Login failed for user 'NT AUTHORITY\ANONYMOUS LOGO hexOffender ASP.NET 1.0 and 1.1 Basics 2 October 24th, 2008 07:26 AM
failed for user 'NT AUTHORITY\NETWORK SERVICE' GS ASP.NET 2.0 Professional 5 March 26th, 2007 05:16 AM
Login failed for user 'NT INSTANS\NETWORK SERVICE' keysersoze BOOK: ASP.NET Website Programming Problem-Design-Solution 3 April 6th, 2005 01:25 PM
login failed for user nt authority\anonymous login rj1406 Classic ASP Databases 1 October 24th, 2004 09:15 AM



All times are GMT -4. The time now is 05:36 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.