connection string.open error 
Author Message
 connection string.open error

I keep getting the error:
An unhandled exception of
type 'System.Data.OleDb.OleDbException' occurred in
system.data.dll
Here's my code:
Imports System.Data
Imports Microsoft.Data.Odbc
Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form
Designer.
        InitializeComponent()

        'Add any initialization after the
InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal
disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the
Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents btnConnectTodBase As
System.Windows.Forms.Button
    <System.Diagnostics.De{*filter*}StepThrough()> Private Sub
InitializeComponent()
        Me.btnConnectTodBase = New
System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'btnConnectTodBase
        '
        Me.btnConnectTodBase.Location = New
System.Drawing.Point(296, 88)
        Me.btnConnectTodBase.Name = "btnConnectTodBase"
        Me.btnConnectTodBase.TabIndex = 0
        Me.btnConnectTodBase.Text = "Connect To dbase"
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5,
13)
        Me.ClientSize = New System.Drawing.Size(712, 341)
        Me.Controls.AddRange(New
System.Windows.Forms.Control() {Me.btnConnectTodBase})
        Me.Name = "Form1"
        Me.Text = "Form1"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub btnConnectTodBase_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btnConnectTodBase.Click
        'Establish a connection to the data source.
        Dim sConnectionString As String
        sConnectionString
= "Provider=Microsoft.Jet.OLEDB.4.0;" & _
        "Data Source=D:\My Documents\dBase;Extended
Properties=dBase IV"
        Dim objConn As New
System.Data.OleDb.OleDbConnection(sConnectionString)
        objConn.Open()
        Dim da As New System.Data.OleDb.OleDbDataAdapter
("Select * from MydBase", objConn)
        Dim ds As New DataSet("dBaseFile")
        da.Fill(ds, "MydBase")
        Dim dt As DataTable
        dt = ds.Tables("mydBase")
        Dim drCurrent As DataRow
        For Each drCurrent In dt.Rows
            Console.WriteLine("{0} {1}", _
                drCurrent("Column1").ToString, _
                drCurrent("Column2").ToString)
        Next
        objConn.Close()

    End Sub
End Class
Yes, I did add a reference to the Microsoft.Data.ODBC.dll
Please, anyone HELP!!!
Thanks in advance



Mon, 27 Dec 2004 02:40:29 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. open connection string error

2. Connection not Open + Server has not yet been opened error messages

3. Opening the connection string.

4. Open/Close Connection String

5. Alter datasource/connection string when opening a VB form

6. Why ISAM error using Access and unbound ADO controls with sql string connection

7. error using connection string w/ access db

8. Change ADO Control connection string at runtime (error)

9. VB to SQL2000 Connection String Error

10. Invalid Connection String Attribute error

11. ADODB Connection String- Two Diff Examples - Two Diff Errors

12. error during opening the connection to ado

 

 
Powered by phpBB® Forum Software