<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.vbex.ru/index.php?action=history&amp;feed=atom&amp;title=VB.Net%2FDatabase_ADO.net%2FOleDb_Table_Schema</id>
		<title>VB.Net/Database ADO.net/OleDb Table Schema - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.vbex.ru/index.php?action=history&amp;feed=atom&amp;title=VB.Net%2FDatabase_ADO.net%2FOleDb_Table_Schema"/>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net/Database_ADO.net/OleDb_Table_Schema&amp;action=history"/>
		<updated>2026-04-05T23:34:44Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.vbex.ru/index.php?title=VB.Net/Database_ADO.net/OleDb_Table_Schema&amp;diff=662&amp;oldid=prev</id>
		<title> в 16:40, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net/Database_ADO.net/OleDb_Table_Schema&amp;diff=662&amp;oldid=prev"/>
				<updated>2010-05-26T16:40:06Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 16:40, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://www.vbex.ru/index.php?title=VB.Net/Database_ADO.net/OleDb_Table_Schema&amp;diff=663&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net/Database_ADO.net/OleDb_Table_Schema&amp;diff=663&amp;oldid=prev"/>
				<updated>2010-05-26T12:44:47Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Use OleDb to get the data table schema==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;&lt;br /&gt;
Imports System&lt;br /&gt;
Imports System.Collections&lt;br /&gt;
Imports System.Data&lt;br /&gt;
Imports System.IO&lt;br /&gt;
Imports System.Xml.Serialization&lt;br /&gt;
Imports System.Xml&lt;br /&gt;
Imports System.Windows.Forms&lt;br /&gt;
Imports System.Data.SqlClient&lt;br /&gt;
Imports System.Data.OleDb&lt;br /&gt;
Public Class MainClass&lt;br /&gt;
    Shared Sub Main()&lt;br /&gt;
        Dim form1 As Form = New Form1&lt;br /&gt;
        Application.Run(form1)&lt;br /&gt;
    End Sub&lt;br /&gt;
End Class&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Public Class Form1&lt;br /&gt;
    Inherits System.Windows.Forms.Form&lt;br /&gt;
#Region &amp;quot; Windows Form Designer generated code &amp;quot;&lt;br /&gt;
    Public Sub New()&lt;br /&gt;
        MyBase.New()&lt;br /&gt;
        &amp;quot;This call is required by the Windows Form Designer.&lt;br /&gt;
        InitializeComponent()&lt;br /&gt;
        &amp;quot;Add any initialization after the InitializeComponent() call&lt;br /&gt;
    End Sub&lt;br /&gt;
    &amp;quot;Form overrides dispose to clean up the component list.&lt;br /&gt;
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)&lt;br /&gt;
        If disposing Then&lt;br /&gt;
            If Not (components Is Nothing) Then&lt;br /&gt;
                components.Dispose()&lt;br /&gt;
            End If&lt;br /&gt;
        End If&lt;br /&gt;
        MyBase.Dispose(disposing)&lt;br /&gt;
    End Sub&lt;br /&gt;
    &amp;quot;Required by the Windows Form Designer&lt;br /&gt;
    Private components As System.ruponentModel.IContainer&lt;br /&gt;
    &amp;quot;NOTE: The following procedure is required by the Windows Form Designer&lt;br /&gt;
    &amp;quot;It can be modified using the Windows Form Designer.  &lt;br /&gt;
    &amp;quot;Do not modify it using the code editor.&lt;br /&gt;
    Friend WithEvents Button1 As System.Windows.Forms.Button&lt;br /&gt;
    Friend WithEvents SchemaTableList As System.Windows.Forms.ListView&lt;br /&gt;
    &amp;lt;System.Diagnostics.DebuggerStepThrough()&amp;gt; Private Sub InitializeComponent()&lt;br /&gt;
        Me.Button1 = New System.Windows.Forms.Button()&lt;br /&gt;
        Me.SchemaTableList = New System.Windows.Forms.ListView()&lt;br /&gt;
        Me.SuspendLayout()&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;Button1&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.Button1.Location = New System.Drawing.Point(808, 520)&lt;br /&gt;
        Me.Button1.Name = &amp;quot;Button1&amp;quot;&lt;br /&gt;
        Me.Button1.Size = New System.Drawing.Size(136, 23)&lt;br /&gt;
        Me.Button1.TabIndex = 3&lt;br /&gt;
        Me.Button1.Text = &amp;quot;Read Schema&amp;quot;&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;SchemaTableList&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.SchemaTableList.Dock = System.Windows.Forms.DockStyle.Top&lt;br /&gt;
        Me.SchemaTableList.Name = &amp;quot;SchemaTableList&amp;quot;&lt;br /&gt;
        Me.SchemaTableList.Size = New System.Drawing.Size(952, 512)&lt;br /&gt;
        Me.SchemaTableList.TabIndex = 2&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;Form1&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 15)&lt;br /&gt;
        Me.ClientSize = New System.Drawing.Size(952, 552)&lt;br /&gt;
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1, Me.SchemaTableList})&lt;br /&gt;
        Me.Name = &amp;quot;Form1&amp;quot;&lt;br /&gt;
        Me.Text = &amp;quot;Form1&amp;quot;&lt;br /&gt;
        Me.ResumeLayout(False)&lt;br /&gt;
    End Sub&lt;br /&gt;
#End Region&lt;br /&gt;
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click&lt;br /&gt;
        Dim conn As OleDbConnection = New OleDbConnection _&lt;br /&gt;
            (&amp;quot;Provider=SQLOLEDB;Data Source=(local)\SQLEXPRESS;Initial Catalog=MyDatabase;uid=sa;pwd=vbex;&amp;quot;)&lt;br /&gt;
        &amp;quot; Retrieving schema for columns from a single table&lt;br /&gt;
        Dim cmd As OleDbCommand = New OleDbCommand(&amp;quot;Employee&amp;quot;, conn)&lt;br /&gt;
        cmd.rumandType = CommandType.TableDirect&lt;br /&gt;
        &amp;quot; Retrieve schema only&lt;br /&gt;
        conn.Open()&lt;br /&gt;
        Dim reader As OleDbDataReader = cmd.ExecuteReader(CommandBehavior.SchemaOnly)&lt;br /&gt;
        &amp;quot; Get references to schema information&lt;br /&gt;
        Dim SchemaTable As DataTable = reader.GetSchemaTable()&lt;br /&gt;
        &amp;quot; Close and release the connection before processing results&lt;br /&gt;
        reader.Close()&lt;br /&gt;
        conn.Close()&lt;br /&gt;
        &amp;quot; Display schema table column headers&lt;br /&gt;
        Dim col As DataColumn&lt;br /&gt;
        SchemaTableList.View = View.Details&lt;br /&gt;
        For Each col In SchemaTable.Columns&lt;br /&gt;
            SchemaTableList.Columns.Add(col.ColumnName, 100, HorizontalAlignment.Left)&lt;br /&gt;
        Next&lt;br /&gt;
        &amp;quot; Display schema&lt;br /&gt;
        Dim row As DataRow&lt;br /&gt;
        Dim ColCount As Integer = SchemaTable.Columns.Count&lt;br /&gt;
        For Each row In SchemaTable.Rows&lt;br /&gt;
            Dim OrderDetails(ColCount) As String&lt;br /&gt;
            Dim ColIdx As Integer&lt;br /&gt;
            For ColIdx = 0 To ColCount - 1&lt;br /&gt;
                OrderDetails(ColIdx) = Convert.ToString(row(ColIdx))&lt;br /&gt;
            Next&lt;br /&gt;
            Dim NewItem As ListViewItem = New ListViewItem(OrderDetails)&lt;br /&gt;
            SchemaTableList.Items.Add(NewItem)&lt;br /&gt;
        Next&lt;br /&gt;
    End Sub&lt;br /&gt;
End Class&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Use OleDb to get the data table schema and display in a DataGrid==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;&lt;br /&gt;
Imports System&lt;br /&gt;
Imports System.Collections&lt;br /&gt;
Imports System.Data&lt;br /&gt;
Imports System.IO&lt;br /&gt;
Imports System.Xml.Serialization&lt;br /&gt;
Imports System.Xml&lt;br /&gt;
Imports System.Windows.Forms&lt;br /&gt;
Imports System.Data.SqlClient&lt;br /&gt;
Imports System.Data.OleDb&lt;br /&gt;
Public Class MainClass&lt;br /&gt;
    Shared Sub Main()&lt;br /&gt;
        Dim form1 As Form = New Form1&lt;br /&gt;
        Application.Run(form1)&lt;br /&gt;
    End Sub&lt;br /&gt;
End Class&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Public Class Form1&lt;br /&gt;
    Inherits System.Windows.Forms.Form&lt;br /&gt;
#Region &amp;quot; Windows Form Designer generated code &amp;quot;&lt;br /&gt;
    Public Sub New()&lt;br /&gt;
        MyBase.New()&lt;br /&gt;
        &amp;quot;This call is required by the Windows Form Designer.&lt;br /&gt;
        InitializeComponent()&lt;br /&gt;
        &amp;quot;Add any initialization after the InitializeComponent() call&lt;br /&gt;
    End Sub&lt;br /&gt;
    &amp;quot;Form overrides dispose to clean up the component list.&lt;br /&gt;
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)&lt;br /&gt;
        If disposing Then&lt;br /&gt;
            If Not (components Is Nothing) Then&lt;br /&gt;
                components.Dispose()&lt;br /&gt;
            End If&lt;br /&gt;
        End If&lt;br /&gt;
        MyBase.Dispose(disposing)&lt;br /&gt;
    End Sub&lt;br /&gt;
    &amp;quot;Required by the Windows Form Designer&lt;br /&gt;
    Private components As System.ruponentModel.IContainer&lt;br /&gt;
    &amp;quot;NOTE: The following procedure is required by the Windows Form Designer&lt;br /&gt;
    &amp;quot;It can be modified using the Windows Form Designer.  &lt;br /&gt;
    &amp;quot;Do not modify it using the code editor.&lt;br /&gt;
    Friend WithEvents Button1 As System.Windows.Forms.Button&lt;br /&gt;
    Friend WithEvents SchemaTableList As System.Windows.Forms.ListView&lt;br /&gt;
    &amp;lt;System.Diagnostics.DebuggerStepThrough()&amp;gt; Private Sub InitializeComponent()&lt;br /&gt;
        Me.Button1 = New System.Windows.Forms.Button()&lt;br /&gt;
        Me.SchemaTableList = New System.Windows.Forms.ListView()&lt;br /&gt;
        Me.SuspendLayout()&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;Button1&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.Button1.Location = New System.Drawing.Point(808, 520)&lt;br /&gt;
        Me.Button1.Name = &amp;quot;Button1&amp;quot;&lt;br /&gt;
        Me.Button1.Size = New System.Drawing.Size(136, 23)&lt;br /&gt;
        Me.Button1.TabIndex = 3&lt;br /&gt;
        Me.Button1.Text = &amp;quot;Read Schema&amp;quot;&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;SchemaTableList&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.SchemaTableList.Dock = System.Windows.Forms.DockStyle.Top&lt;br /&gt;
        Me.SchemaTableList.Name = &amp;quot;SchemaTableList&amp;quot;&lt;br /&gt;
        Me.SchemaTableList.Size = New System.Drawing.Size(952, 512)&lt;br /&gt;
        Me.SchemaTableList.TabIndex = 2&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;Form1&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 15)&lt;br /&gt;
        Me.ClientSize = New System.Drawing.Size(952, 552)&lt;br /&gt;
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1, Me.SchemaTableList})&lt;br /&gt;
        Me.Name = &amp;quot;Form1&amp;quot;&lt;br /&gt;
        Me.Text = &amp;quot;Form1&amp;quot;&lt;br /&gt;
        Me.ResumeLayout(False)&lt;br /&gt;
    End Sub&lt;br /&gt;
#End Region&lt;br /&gt;
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click&lt;br /&gt;
        Dim conn As OleDbConnection = New OleDbConnection _&lt;br /&gt;
            (&amp;quot;Provider=SQLOLEDB;Data Source=(local)\SQLEXPRESS;Initial Catalog=MyDatabase;uid=sa;pwd=vbex;&amp;quot;)&lt;br /&gt;
        &amp;quot; Retrieving schema for columns from a single table&lt;br /&gt;
        Dim cmd As OleDbCommand = New OleDbCommand(&amp;quot;Employee&amp;quot;, conn)&lt;br /&gt;
        cmd.rumandType = CommandType.TableDirect&lt;br /&gt;
        &amp;quot; Retrieve schema only&lt;br /&gt;
        conn.Open()&lt;br /&gt;
        Dim reader As OleDbDataReader = cmd.ExecuteReader(CommandBehavior.SchemaOnly)&lt;br /&gt;
        &amp;quot; Get references to schema information&lt;br /&gt;
        Dim SchemaTable As DataTable = reader.GetSchemaTable()&lt;br /&gt;
        &amp;quot; Close and release the connection before processing results&lt;br /&gt;
        reader.Close()&lt;br /&gt;
        conn.Close()&lt;br /&gt;
        &amp;quot; Display schema table column headers&lt;br /&gt;
        Dim col As DataColumn&lt;br /&gt;
        SchemaTableList.View = View.Details&lt;br /&gt;
        For Each col In SchemaTable.Columns&lt;br /&gt;
            SchemaTableList.Columns.Add(col.ColumnName, 100, HorizontalAlignment.Left)&lt;br /&gt;
        Next&lt;br /&gt;
        &amp;quot; Display schema&lt;br /&gt;
        Dim row As DataRow&lt;br /&gt;
        Dim ColCount As Integer = SchemaTable.Columns.Count&lt;br /&gt;
        For Each row In SchemaTable.Rows&lt;br /&gt;
            Dim OrderDetails(ColCount) As String&lt;br /&gt;
            Dim ColIdx As Integer&lt;br /&gt;
            For ColIdx = 0 To ColCount - 1&lt;br /&gt;
                OrderDetails(ColIdx) = Convert.ToString(row(ColIdx))&lt;br /&gt;
            Next&lt;br /&gt;
            Dim NewItem As ListViewItem = New ListViewItem(OrderDetails)&lt;br /&gt;
            SchemaTableList.Items.Add(NewItem)&lt;br /&gt;
        Next&lt;br /&gt;
    End Sub&lt;br /&gt;
End Class&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>