473,659 Members | 2,922 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 6516
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******** ******@TK2MSFTN GP09.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******** ******@TK2MSFTN GP09.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
3539
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
1759
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. more of the error i get: at System.Data.DataTable.RecordStateChanged(Int32 record1, DataViewRowState oldState1, DataViewRowState newState1, Int32 record2, DataViewRowState oldState2, DataViewRowState newState2)
5
1937
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, SelSort, SelSortDir) availMachList.DataSource = dstMachList
1
2045
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 made by two users at the same time, the second user take a error. The problem is that 'Fill' internal uses a DataReader and only one DataReader can be opened at the time, and when the 2 users open the DataReader (internal to Fill) throw a...
2
2509
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 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
5
2074
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 contain a definition for 'Fill' error // dsRevenue is my datareader object ds = new DataSet( ); drRevenue.Fill(ds);
0
1346
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 help. Jason
0
4547
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 IBM.Data.DB2.iSeries; Version: v1.0.3705 (is there an newer one for OS/400 Version ist V5R3 ?) or is it a hardware faoult (memory of as400 or pc) ? br mike Es wurde versucht, im geschützten Speicher zu lesen oder zu schreiben. Dies ist häufig ein...
2
2974
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 DataAdapter fill DataTable couple times? For example, I only read 5000 columns from the view each time and I read 3 times. It has an id
0
8428
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8335
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8747
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8627
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7356
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2752
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1976
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.