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
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


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...