Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Datagrid, SQLReader and Paging? Shouldn't this work?

Reply
Thread Tools

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

 
 
Roger
Guest
Posts: n/a
 
      12-28-2004
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


 
Reply With Quote
 
 
 
 
R. Thomas, aka Xtreme.Net
Guest
Posts: n/a
 
      12-29-2004
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


"Roger" wrote:

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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
if and and vs if and,and titi VHDL 4 03-11-2007 05:23 AM
sqlreader.GetValue(sqlreader.GetOrdinal(columnname) problem =?Utf-8?B?YzY3NjIyOA==?= ASP .Net 5 02-24-2006 06:57 PM
Is it possible to update records when read by an SqlReader object? Rico Alexander ASP .Net 1 10-14-2003 02:18 AM



Advertisments