binding a datareader to a grid

Results 1 to 2 of 2

Thread: binding a datareader to a grid

  1. #1
    Join Date
    Dec 1969

    Default binding a datareader to a grid

    I know that you can bind a dataset to a datagrid, but I hoping to accomplish the same functionality with a datareader (it is after all a forward only application)<BR><BR>thanks in advance,<BR>Joel

  2. #2
    Darren Neimke Guest

    Default RE: binding a datareader to a grid

    I don&#039;t have the .NET runtime installed on my PC here at work, but, have you tried something like....<BR><BR> Dim objCnn As New SQLConnection(strConn)<BR> Dim objCmd As New SQLCommand(strCmd, objCnn)<BR> Dim objDR As SQLDataReader = Nothing<BR> objCmd.ActiveConnection.Open()<BR> objCmd.Execute(objDR)<BR><BR> DataGrid.DataSource = objDR<BR> DataGrid.DataBind<BR><BR>According to the QuickStart docs...<BR><BR> "controls can bind only to collections that <BR> "support the ICollection interface"<BR><BR>... although I&#039;m not sure that the DBDataReader Class (which is implemented by both SQLDataReader and ADODataReader)implements the ICollection interface.<BR><BR>Here is where I looked (watch out for wrapping)...<BR><BR><BR ><BR><BR>HTH<BR><BR>Darren<BR>[ ]<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts