Click to See Complete Forum and Search --> : Datagrid


Narmada Gosula
June 22nd, 2001, 01:19 AM
hi ,
is it possible to add multiple records in a datagrid at runtime...if so....how?

praveen b p
June 26th, 2001, 04:32 AM
Hi Narmada Gosula,

Yes we can add multiple records to datagrid at runtime.. (I think following code may help you)

-------------------------------------------------

Option Explicit
Dim objRs As New ADODB.Recordset

Private Sub Command1_Click()
Set DataGrid1.DataSource = objRs
DataGrid1.Refresh
End Sub

Private Sub Form_Load()
objRs.ActiveConnection = "DSN=DSNname;UID=UserName;PWD=Password;"
objRs.LockType = adLockOptimistic
objRs.CursorType = adOpenStatic
objRs.Open "Select * from TableName", , , , adCmdText
End Sub

'bpp