You just need to set the datagrid's datasource to the datareader object and then enabled the Databind() method.
Dim myCommand as New SqlCommand(strSQL, myConnection)
'Set the datagrid's datasource to the datareader and databind
myConnection.Open()
dgMyGrid.DataSource = myCommand.ExecuteReader( CommandBehavior.CloseConnection )
dgMyGrid.DataBind()
That is all you should need to do to get it bound to the datagrid control.
Hope it works for you! Enjoy!
No comments:
Post a Comment