473,320 Members | 2,164 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Fill TextBox with DataReader...

In my C# Web Application
I need to fill a textbox with DataReader and use a Next Button to view next
value...
I created the Datareader in the Page_Load but everytime it get result of the
First row.
If i use a While or For loop i get result of the last row...
How can i check "PostBack" to do so our if there is another way to fill the
textbox and use the Next button to see next result rather than DataReader??
thanx
Nov 16 '05 #1
2 6492
Jay
you can keep track of the current record number in a variable and store it
either in the view state of the page / Session / Hiden control.
and skip that many records the next time the button_click event is caled.

instead if you don't 've much data returned from the database call , then
you can fill the datatable / dataset and store this in Session also store
the current datarow being displayed and on the next button_click , skip that
many rows. this methood will eliminate multiple database calls everytime the
button_click event is called.
Will this do ?

Jay

"Islam Elkhayat" <is******@yahoo.com> wrote in message
news:eP**************@TK2MSFTNGP09.phx.gbl...
In my C# Web Application
I need to fill a textbox with DataReader and use a Next Button to view
next value...
I created the Datareader in the Page_Load but everytime it get result of
the First row.
If i use a While or For loop i get result of the last row...
How can i check "PostBack" to do so our if there is another way to fill
the textbox and use the Next button to see next result rather than
DataReader??
thanx

Nov 16 '05 #2
Instead of using datareader, you can use dataset. During page_load you can
load the dataset and you can store it in session. When post back occurs you
can find the current record id from hidden field or viewstate and then you
can populate the next record in textbox.

--
Saravana
http://dotnetjunkies.com/WebLog/saravana/
www.ExtremeExperts.com
"Islam Elkhayat" <is******@yahoo.com> wrote in message
news:eP**************@TK2MSFTNGP09.phx.gbl...
In my C# Web Application
I need to fill a textbox with DataReader and use a Next Button to view next value...
I created the Datareader in the Page_Load but everytime it get result of the First row.
If i use a While or For loop i get result of the last row...
How can i check "PostBack" to do so our if there is another way to fill the textbox and use the Next button to see next result rather than DataReader?? thanx

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: ad | last post by:
I have a datetime filed, name Birthday. I use aTexBox.Text= ((DateTime)dr).ToShortDateString(); but it result in an .InvalidCastException: How can I datetime field in a TextBox?
0
by: Seiche V via DotNetMonster.com | last post by:
hy. i want to fill a data table from a dataset using SqlDataAdapter.fill(myTable), but i get the error: System.NullReferenceException: Object reference not set to an instance of an object. ...
5
by: Helixpoint | last post by:
Here is my code: Dim availMach As New ASPNETProduct.machinedb() Dim dstMachList As DataSet dstMachList = availMach.GetAvailMach(theSearchVal, theSearchBy, theMachCode1, theSearchView,...
1
by: Jorge Maganto | last post by:
Hi! I'm building a site in ASP.NET which makes a query that return 50.000 results, this result is read by a DataAdapter to a DataSet (myDataAdter.Fill(myDataSet)). The problem is if the query is...
2
by: Islam Elkhayat | last post by:
In my C# Web Application I need to fill a textbox with DataReader and use a Next Button to view next value... I created the Datareader in the Page_Load but everytime it get result of the First...
5
by: .Net Sports | last post by:
I have an open datareader that gets data from an sql statement, but when I try to put it into a dataset so that my datagrid can pick it up, I get a 'System.Data.SqlClient.SqlDataReader' does not...
0
by: Jason Huang | last post by:
Hi, In my C# Windows Form MyForm, it has a ListView ListView1. How do I fill the data from a DataReader into ListView1 if the DataReader if the DataReader has 3 rows and 5 columns? Thanks for...
0
by: mike1402 | last post by:
Hi ! I get the error below sometimes when retrieving a big amount of data using Datadapter.Fill(dataset,"table"). But when I send the command Fill again, there is no error. Is it a fault of...
2
by: Ryan Liu | last post by:
Hi, If I have a very big view in database, it covers 15 tables, each table has 1000 columns. When I issue select * from view, the database will give error -- too many columns. Can I use a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.