Fill textboxes

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
        FillControls()

        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
VBdotnet2005Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

prakash_prkCommented:
what is the error u got?
0
hagipmcCommented:
probably your database is locked and/or read-only..
0
the_paabCommented:
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
0
maralansCommented:
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"
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.