This is the code i am using for displaying data into the DataGrid,bt its not working,plz help

Set DataGrid1.DataSource = rs
If rs.EOF And rs.BOF Then
MsgBox "Invalid Entry", vbOKOnly, "Stop!!"
Exit Sub
End If
Do
DataGrid1.Columns(0).Caption = rs!PS_NO
DataGrid1.Columns(1).Caption = rs!Name
DataGrid1.Columns(2).Caption = rs!DT_PREP
DataGrid1.Columns(3).Caption = rs!ADV
DataGrid1.Columns(4).Caption = rs!NATURE_EXP
While rs.EOF
Wend
Loop

Hi,

You can change the caption from the properties of the control or if u want to do it by code then do it only once..
For example:

Datagrid1.Columns(0).Caption = "Surname"
Datagrid1.Columns(1).Caption = "Name"
....
....

The loop was not necessary.
Check the attachment file...

Good luck...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.