Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim strConnection As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & "C:/dbtest.mdb"
Dim strCommand As String = "SELECT * FROM binFrm"
OpenAccess(strConnection, strCommand)
End Sub
Public Function OpenAccess(ByVal strConn As String, ByVal strComm As String)
Dim i As Integer, x As Integer
Dim DBCon As New OleDbConnection(strConn)
DBCon.Open()
Dim DBCommand As New OleDbCommand(strComm, DBCon)
Dim DBAdapt(2) As OleDbDataAdapter /// make an array of each table in your database.
DBAdapt(1) = New OleDbDataAdapter(DBCommand)
DBAdapt(2) = New OleDbDataAdapter(DBCommand)
Dim DBset As New DataSet
DBAdapt(1).Fill(DBset, "binFrm")
DBAdapt(2).Fill(DBset, "Addresses")
For i = 0 To DBset.Tables.Count - 1
For x = 0 To DBset.Tables.Item(i).Columns.Count - 1
Dim strTable As String = DBset.Tables.Item(i).TableName
Dim strColumn As String = DBset.Tables.Item(i).Columns(x).ColumnName
MessageBox.Show("the tabel: " & strTable & " Contains the following Columns:" & Chr(10) & strColumn)
Next
Next
DBCon.Close()
DBCommand.Dispose()
DBAdapt(1).Dispose()
DBAdapt(2).Dispose()
DBset.Dispose()
End Function
[/VB]
But there is no table which have this name --> binFrm of this line SELECT * FROM binFrm
I change this line for --> SELECT * FROM UserTable
then the msgbox give me :
"the tabel: binFrm Contains the following Columns:
N