[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Fill textboxes

Posted on 2006-04-24
4
Medium Priority
?
206 Views
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
        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
0
Comment
Question by:VBdotnet2005
4 Comments
 
LVL 10

Expert Comment

by:prakash_prk
ID: 16532225
what is the error u got?
0
 
LVL 1

Expert Comment

by:hagipmc
ID: 16532341
probably your database is locked and/or read-only..
0
 
LVL 6

Expert Comment

by:the_paab
ID: 16532524
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
 
LVL 5

Accepted Solution

by:
maralans earned 1000 total points
ID: 16533579
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

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
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…
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
SQL Database Recovery Software repairs the MDF & NDF Files, corrupted due to hardware related issues or software related errors. Provides preview of recovered database objects and allows saving in either MSSQL, CSV, HTML or XLS format. Ensures recov…
Suggested Courses

590 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