VB.Net-Informations.com
   Home      .Net Framework      VB.NET      C#                                                                      About


  Schema Informations from OleDbDataReader

The OleDbDataReader Object is a stream-based , forward-only, read-only retrieval of query results from the Data Source, which do not update the data. When the ExecuteReader method in oledbCmd Object execute , it instantiate a OleDb.OleDbDataReader Object.

Dim oledbReader As OleDbDataReader = oledbCmd.ExecuteReader()

While a OleDbDataReader is open, you can retrieve schema information about the current result set using the GetSchemaTable method. GetSchemaTable returns a DataTable object populated with rows and columns that contain the schema information for the current result set.

         VB.NET Source Code Download           Print Source Code
         Schema Informations from OleDbDataReader - Download
        
C# Tutorial

Imports System.Data.OleDb
Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim connetionString As String
        Dim oledbCnn As OleDbConnection
        Dim oledbCmd As OleDbCommand
        Dim sql As String

        connetionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Your mdb filename;"
        sql = "Your SQL Statement Here like Select * from product"

        oledbCnn = New OleDbConnection(connetionString)
        Try
            oledbCnn.Open()
            oledbCmd = New OleDbCommand(sql, oledbCnn)
            Dim oledbReader As OleDbDataReader = oledbCmd.ExecuteReader()
            Dim schemaTable As DataTable = oledbReader.GetSchemaTable()
            Dim row As DataRow
            Dim column As DataColumn
            For Each row In schemaTable.Rows
                For Each column In schemaTable.Columns
                    MsgBox(String.Format("{0} = {1}", column.ColumnName, row(column)))
                Next
            Next
            oledbReader.Close()
            oledbCmd.Dispose()
            oledbCnn.Close()
        Catch ex As Exception
            MsgBox("Can not open connection ! ")
        End Try
    End Sub
End Class

connetionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Your mdb filename;"
sql = "Your SQL Statement Here like Select * from product"

You have to replace the string with your realtime variables.


ADO.NET Data Providers Related Contents
*     ADO.NET Connection Object
*     ADO.NET SQL Server Connection
*     ADO.NET OLEDB Connection
*     ADO.NET ODBC Connection
*     ADO.NET Command
*     ADO.NET ExecuteNonQuery in SqlCommand Object
*     ADO.NET ExecuteNonQuery in OleDbCommand Object
*     ADO.NET ExecuteScalar in SqlCommand Object
*     ADO.NET ExecuteScalar in OleDbCommand Object
*     ADO.NET ExecuteReader in SqlCommand Object
*     ADO.NET ExecuteReader in OleDbCommand Object
*     How to ADO.NET DataReader
*     How to ADO.NET SqlDataReader
*     How to ADO.NET OleDbDataReader
*     How to Multiple Result Sets in ADO.NET
*     Getting Schema Informations from SqlDataReader
*     What is DataAdapter
*     What is SqlDataAdapter
*     What is OleDbDataAdapter
*     Vb.NET ExecuteReader and ExecuteNonQuery


   Home      VB.NET      C#
VB.Net Related Topics
*     Microsoft .Net Framework Tutorials
*     VB.NET Language Basics Tutorials
*     VB.NET Program Flow Control Tutorials
*     VB.NET Collections Tutorials
*     VB.NET String Tutorials
*     VB.NET Files Tutorials
*     VB.NET Excel 2007 Tutorials
*     VB.NET Crystal Reports Tutorials
*     VB.NET Communications Tutorial
*     VB.NET ADO.NET Tutorial
*     ADO.NET Data Providers help and Tutorial
*     VB.NET ADO.NET Dataset Tutorial
*     ADO.NET DataAdapter and Dataset
*     VB.NET ADO.NET DataView Tutorial
*     VB.NET Remoting Tutorial
*     VB.NET XML Tutorial
*     VB.NET DataGridView Tutorial
   Home      VB.NET      C#
More Source Code :   
Mail to :  feedback@net-informations.com
  |  Home   |  VB.NET   |  C#   |  SiteMap   |  Terms of Use   |  About   |
net-informations.com (C) 2010
All Rights Reserved. All other trademarks are property of their respective owners.