View Single Post
  #1 (permalink)  
Old November 4th, 2004, 11:06 AM
ElPato ElPato is offline
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>