The Infragistics UltraGrid? If you are on the desktop, you'll need to use a
DataTable/DataSet/DataView...on the Web you can use a DataReader to populate
the grid which is going to be faster...
Here's some code I was playing around with..not the most elegant, but it
works....
HTH,,
Bill
Imports System.Data.SqlClient
Imports System.Configuration
Public Class frmTitleDescription
Inherits System.Windows.Forms.Form
Private cn As SqlConnection
Private da As SqlDataAdapter
Private da2 As SqlDataAdapter
Private ds As New DataSet
Private dv As New DataView
Private bmb As BindingManagerBase
Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnClose.Click
Me.Dispose()
End Sub
Private Sub frmTitleDescription_Load(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MyBase.Load
Try
FillAndPopulate()
FillTitles()
Dim rel As DataRelation
rel = New DataRelation("WorkTypeDesc", ds.Tables(0).Columns(0),
ds.Tables(1).Columns(0))
ds.Relations.Add(rel)
InitializeBinding()
Catch ex As Exception
End Try
End Sub
Private Sub InitializeBinding()
Try
bmb = Me.BindingContext(ds.Tables(0))
bmb.Position = 0
'dv = ds.Tables(1).DefaultView
dg.DataSource = ds.Tables(0)
dg.DataMember = ""
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End Sub
Private Sub FillTitles()
cn = New
SqlConnection(ConfigurationSettings.AppSettings.Item("connectString").ToStri
ng)
da2 = New SqlDataAdapter("Select * From tbl_TitleDescriptions", cn)
Dim sqlCmdBuilder As SqlClient.SqlCommandBuilder
sqlCmdBuilder = New SqlClient.SqlCommandBuilder(da2)
Try
da2.Fill(ds, "Titles")
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End Sub
Private Sub FillAndPopulate()
cn = New
SqlConnection(ConfigurationSettings.AppSettings.Item("connectString").ToStri
ng)
da = New SqlClient.SqlDataAdapter("Select * from tbl_WorkTypes", cn)
Dim sqlCmdBuilder As SqlClient.SqlCommandBuilder
sqlCmdBuilder = New SqlClient.SqlCommandBuilder(da)
Try
da.Fill(ds, "WorkTypes")
Catch ex As Exception
End Try
Dim dr As DataRow
For Each dr In ds.Tables(0).Rows
ulbWorkTypes.Groups(0).Items.Add(dr(0).ToString)
'ulbWorkTypes.Groups(0).Items(dr(0).ToString).Key = dr(0).ToString
ulbWorkTypes.Groups(0).Items(dr(0).ToString).Text = dr(1).ToString
ulbWorkTypes.Groups(0).Items(dr(0).ToString).Appearance.ForeColor =
Color.White
Next
End Sub