*** HELP *** Problems Accessing Simple VB.NET Access Database

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • samadams_2006@yahoo.ca

    *** HELP *** Problems Accessing Simple VB.NET Access Database


    1) I have a .NET Web Application called "Lesson18b" under
    "C:\Inetpub\www root\Lesson18b" .

    2) I have one Web Form on this Lesson called "Form18b.as px"

    3) In this same Folder under Inetpub I have the famous NorthWinds
    Access Database called "FPNWIND.MD B"

    4) I add an OleDBConnection called OleDBConnection 1. I set the "New
    Connection" Properties to: Provider is "Microsoft Jet 4.0 OLE DB
    Provider". Database Name is "FPNWIND.MD B". User name is
    "Admin". Blank Password is checked. I test the connection and it
    states that the "Test Connection Succeeded". I choose not to
    include a password in the connection string.

    5) I then add an OleDBCommand called OleDBCommand1. I set the
    connection to OleDBConnection 1. For the command text I select the
    "..." and when asked, I add table "Customers" . I move "All
    Columns" to the grid below, producing the SQL "SELECT
    Customers.* FROM Customers". When I right click the bottom
    grid and choose "Run", it fills the grid with data. So far, so
    good.

    6) Back on the form Form18.aspx I add a text field called
    "txtResults " and a command button called "Button1".

    7) Double-clicking on "Button1", I add the following lines of
    code:

    Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
    System.EventArg s) Handles Button1.Click
    Dim dr As OleDb.OleDbData Reader
    OleDbConnection 1.Open()
    dr = OleDbCommand1.E xecuteReader
    While dr.Read
    txtResults.Text = dr.GetValue(0)
    End While
    End Sub

    8) When I build, then run the application, and click on "Button1",
    I get the following error:

    We can't find http://localhost/Lesson18b/Form18b.aspx
    Error - Internal server error

    9) If I debug the application, it bombs on the following line in
    Button1:

    OleDbConnection 1.Open()


    I'm trying to get the data to display on txtResults. This code works
    fine in a regular VB App...but for some reason it will not work on this
    Web VB App.

    Does anyone have any ideas on why this is happening?

Working...