all groups > asp.net datagrid control > december 2004 >
You're in the

asp.net datagrid control

group:

Datagrid, SQLReader and Paging? Shouldn't this work?


Datagrid, SQLReader and Paging? Shouldn't this work? Roger
12/28/2004 8:49:47 AM
asp.net datagrid control:
I have some code that uses a SQL Stored procedure to return some rows. I
would then like to have these rows show up in a datagrid.

sqlCmd = New SqlClient.SqlCommand("R_GetSiphonDetail", sCon)
sqlCmd.CommandType = CommandType.StoredProcedure
rdr = sqlCmd.ExecuteReader(CommandBehavior.Default)
DataGrid1.DataSource = rdr
DataGrid1.DataBind()

This works just fine as long as I don't turn on paging.

As soon as I check the paging option, then the grid will not show up at all.
Why?????


Thanks,

Rog

RE: Datagrid, SQLReader and Paging? Shouldn't this work? R. Thomas, aka Xtreme.Net
12/29/2004 12:41:01 AM
Hi Roger, using DataReader you wont be able to do pagination 'cause
DataReader provides forward only read.
I suggest you use a dataset to bind to your datagrid
P.S : If this post was usefull to you, please clikc 'Yes' on top of this
post. Thanks
Hth...
R. Thomas


[quoted text, click to view]
AddThis Social Bookmark Button