Imports System.Data.OleDb Public Class Form1 Inherits System.Windows.Forms.Form Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim conn As OleDbConnection = New OleDbConnection _ ("Provider=SQLOLEDB;Data Source=(local);Initial Catalog=Northwind;Integrated Security=SSPI;") Dim command As OleDbCommand = New OleDbCommand("ORDERS", conn) command.CommandType = CommandType.TableDirect Try conn.Open() Dim reader As OleDbDataReader = _ command.ExecuteReader(CommandBehavior.SchemaOnly) DataGrid1.SetDataBinding(reader.GetSchemaTable(), "") reader.Close() Finally conn.Close() End Try End Sub |