View Single Post
  #3 (permalink)  
Old November 14th, 2004, 10:03 AM
jolo98 jolo98 is offline
Authorized User
Join Date: Jul 2004
Location: Bandar Seri Begawan, Brunei-Muara, Brunei.
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts

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

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

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

<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)
    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()
End Sub

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.