Imports System
Imports System.Drawing
Imports System.Collections
Imports System.ComponentModel
Imports System.Windows.Forms
Imports System.Data
Imports System.Data.SqlClient
Public Class MainClass
Shared Sub Main( )
Application.Run(New ADOForm1() )
End Sub
End Class
Public Class ADOForm1
Inherits System.Windows.Forms.Form
Private components As System.ComponentModel.Container
Friend WithEvents EmployeeDataGrid As _
System.Windows.Forms.DataGrid
Public Sub New( )
InitializeComponent( )
Dim connectionString As String ="server=(local)\SQLEXPRESS;" & _
"integrated security=sspi;database=MyDatabase"
Dim commandString As String = _
"Select FirstName, LastName from Employee"
Dim myDataAdapter As _
New SqlDataAdapter(commandString, connectionString)
Dim myDataSet As New DataSet( )
myDataAdapter.Fill(myDataSet, "Employee")
' bind the DataSet to the grid
EmployeeDataGrid.DataSource = _
myDataSet.Tables("Employee").DefaultView
End Sub 'New
Private Sub InitializeComponent( )
Me.components = New System.ComponentModel.Container( )
Me.EmployeeDataGrid = New System.Windows.Forms.DataGrid( )
EmployeeDataGrid.Location = New System.Drawing.Point(48, 24)
EmployeeDataGrid.Size = New System.Drawing.Size(368, 160)
EmployeeDataGrid.TabIndex = 0
Me.Text = "ADOFrm1"
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(464, 273)
Me.Controls.Add(EmployeeDataGrid)
End Sub
End Class