Results 1 to 2 of 2

Thread: Unhandled exception of type "System.Data.OleDB.....

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2002
    Location
    Colorado
    Posts
    83

    Unhandled exception of type "System.Data.OleDB.....

    I keep getting:

    An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll

    But there is no explanation of what is wrong other then that. And its on this line:
    objOwnerDA.FillSchema(objDataSet, SchemaType.Source, "Owners")

    Marked Below with an '***************** above it.

    Anyone have some ideas?


    Code:
    Dim objConnection As New OleDb.OleDbConnection( _
        "Provider=MicroSoft.Jet.OLEDB.4.0;Data Source=C:\Surgery.mdb")
        Dim objOwnerDA As New OleDb.OleDbDataAdapter("Selct * from Owners", _
        objConnection)
        Dim objOwnerCB As New OleDb.OleDbCommandBuilder(objOwnerDA)
        Dim objDataSet As New DataSet()
    
    
        Private Sub btnRetrieve_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btbRetreive.Click
            'Clears DataSet Of any existing Data
            objDataSet.Clear()
    
            'Fill schema - adds table structure information to Dataset
            'Not essential, but handles primary keys for us, etc.
    '*************************************************
            objOwnerDA.FillSchema(objDataSet, SchemaType.Source, "Owners")
    
            'Fills Dataset with info from out DataAdapter
            objOwnerDA.Fill(objDataSet, "Owners")
    
            ' Empty combo Box
            cboOwners.Items.Clear()
    
            ' Loop through each row, adding the OwnerID to to combo box
            Dim i As Integer, strCurrentID As String
    
            For i = 1 To objDataSet.Tables("Owners").Rows.Count
                strCurrentID = objDataSet.Tables("Owners").Rows(i - 1).Item("OwnerID")
                cboOwners.Items.Add(strCurrentID)
            Next
    
            'Select first item in the list
            cboOwners.SelectedIndex = 0
    
    
        End Sub
    Last edited by Jes|er; Aug 10th, 2002 at 03:59 PM.
    12/32/84 - I need some code to make me a sandwhich.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width