data through datagrid
Hi,
I need source code for data through datagrid
this is my code some error are there in that
Pl check,
Imports System
Imports System.Drawing
Imports System.Collections
Imports System.ComponentModel
Imports System.Windows.Forms
Imports System.Data
Imports System.Data.SqlClient
Public Class Form1
Inherits System.Windows.Forms.Form
Private components1 As System.ComponentModel.Container
Friend WithEvents EmployeeDataGrid As System.Windows.Forms.DataGrid
Public Sub New()
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
Dim connectionString As String = "trusted_connection = Yes; database=GPS"
Dim commandString As String = "Select * from GPSTABLE"
Dim myDataAdapter As New SqlDataAdapter(commandString, connectionString)
Dim myDataSet As New DataSet()
myDataAdapter.Fill(myDataSet, "GPSTABLE")
EmployeeDataGrid.DataSource = myDataSet.Tables("GPSTABLE").DefaultView
End Sub
Public 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 = "Form1"
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(464, 273)
Me.Controls.Add(EmployeeDataGrid)
End Sub
End Class