Click here to Skip to main content
15,922,696 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi All,

In administrative Tools ODBC Data Sources (64-bit) configuration ,Please find the attached screenshot where i have a datasource configured.

Example:

Standarad Part Library 32/64 -bit Server

Standarad Part Library0904 32/64 -bit Microsoft Access Driver (*.mdb)

How to establish connection for both SQL Server and Microsoft Access Driver in VB .net or C#

connection to sqlserver or MDB anyone item at a time.
Please help me.

Thanks & Regards,

Sampath

What I have tried:

Dim MyConnection As System.Data.OleDb.OleDbConnection
Dim DtSet As System.Data.DataSet
Dim MyCommand As System.Data.OleDb.OleDbDataAdapter

Dim DatabasePath As String = "C:\Wdir\MDB\DXEXP_UK.mdb;"



Dim ConnString As String = "Provider=Microsoft.ACE.OLEDB.12.0;" & "Data Source=Standard;UID=user;PWD=password" & "Persist Security Info=False"

Dim SchemaTable As DataTable

'Connect to the database
Dim conn As New System.Data.OleDb.OleDbConnection(ConnString)

Try


conn.Open()


SchemaTable = conn.GetOleDbSchemaTable(System.Data.OleDb.OleDbSchemaGuid.Tables, New Object() {Nothing, Nothing, Nothing, Nothing})

Dim int As Integer
For int = 0 To SchemaTable.Rows.Count - 1
If SchemaTable.Rows(int)!TABLE_TYPE.ToString = "TABLE" Then

MsgBox(SchemaTable.Rows(int)!TABLE_NAME.ToString())
conn.Close()
Exit For
End If
Next

Catch ex As Exception
MessageBox.Show(ex.Message.ToString(), "Data Load Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End Try
Posted
Updated 26-Apr-20 22:01pm

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900