Fill textboxes

Posted on 2006-04-24
Last Modified: 2010-04-23
Why do I keep getting error here?  

Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoad.Click

        Dim commandstring As String = "SELECT ID, Make, Model, Type, Year FROM  CarTable"
        Dim ConnectionString As String = "provider=microsoft.jet.oledb.4.0;" + "datasource = E:\car.mdb"
        Dim conn As New OleDbConnection(connectionstring)

        Dim dataAdapter As New OleDbDataAdapter

        dataAdapter.SelectCommand = New OleDbCommand(commandstring, conn)

        Dim myDataset As New DataSet

        dataAdapter.Fill(myDataset, "CarTable")        -----------------------ERROR -------------
        datatable = myDataset.Tables("CarTable")
        currRec = 0
        totalRec = datatable.Rows.Count

        Me.btnForward.Enabled = True
        Me.btnBackWard.Enabled = True

    End Sub

    Private Sub FillControls()

        Me.txtYear.Text = datatable.Rows(currRec)("Year")

        Me.txtMake.Text = datatable.Rows(currRec)("Make")

        Me.txtModel.Text = datatable.Rows(currRec)("Model")

        Me.txtType.Text = datatable.Rows(currRec)("Type")

    End Sub
Question by:VBdotnet2005
    LVL 10

    Expert Comment

    what is the error u got?
    LVL 1

    Expert Comment

    probably your database is locked and/or read-only..
    LVL 6

    Expert Comment

    Maybe some of table column names collide with MS Access reserved words, try change your select command like this:
    SELECT [ID], [Make], [Model], [Type], [Year] FROM CarTable
    LVL 5

    Accepted Solution

    I think it is throwing an ISAM error.  Use this as a connection string.  Data Source should be 2 words and not 1.

    Dim ConnectionString As String = "provider = microsoft.jet.oledb.4.0;data source = E:\car.mdb"

    instead of:

    Dim ConnectionString As String = "provider=microsoft.jet.oledb.4.0;" + "datasource = E:\car.mdb"

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    Article by: Kraeven
    Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now