473,804 Members | 2,134 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Viewing the NEXT RECORD using DATA READER

I have an application (ASP.Net using C# ) . I need to read records from the
database based on the value entered by the user. Using Data Reader , I can
see only one record in text boxes. But how do i view the next record in the
text boxes?? I found out that using DataReader.Next Record() , it is
possible. Is the following code correct?

My code ::
System.Data.Sql Client.SqlDataR eader d1;

private void Page_Load(objec t sender, System.EventArg s e)
{
// Put user code to initialize the page here

}

private void Button1_Click(o bject sender, System.EventArg s e)
{

sqlCommand1.Par ameters["@a"].Value=txtC.Tex t;
sqlConnection1. Open();
d1= sqlCommand1.Exe cuteReader();
do
{

while(d1.Read() )
{
TextBox3.Text= d1["Company"].ToString();
TextBox4.Text=d 1["Ceo"].ToString();
TextBox5.Text=d 1["Month"].ToString();
}
}while(d1.NextR esult());
d1.Close();
sqlConnection1. Close();
}
--
pmud
Jul 21 '05 #1
0 1695

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

Similar topics

5
9481
by: Bob Bedford | last post by:
Does exist a next prev function in PHP/Mysql. I've a website with returns lot of records (say about 200). The user may browse trough the list or returned records, but he has to click the record result then click back's browser in order to see the next record. I'd like to provide a "see next" and "see previous" record in the details itself. How to do so ? Bob
2
10126
by: rob | last post by:
I'm having some trouble with this.. My VB datareader seems to skip the first record in the reader. I've looked at my query in enterprise manager to confirm what I am suppose to receive back, and what the data reader starts at is the second record in the reader. I've done read test to make sure there is a result in the datareader ("If rd.read Then blah") but does that advance the row position? Can I set it back?
6
320
by: Kulwinder Sayal | last post by:
Hi In ASP it was so simple to get the no. of records using RecordCount. Can anyone help me how to write the no. of records my sqlquery has searched Thanks Kulwinder
0
400
by: pmud | last post by:
I have an application (ASP.Net using C# ) . I need to read records from the database based on the value entered by the user. Using Data Reader , I can see only one record in text boxes. But how do i view the next record in the text boxes?? I found out that using DataReader.NextRecord() , it is possible. Is the following code correct? My code :: System.Data.SqlClient.SqlDataReader d1; private void Page_Load(object sender,...
10
5313
by: NH | last post by:
I have a girdview with paging enabled. How can I add a message in the footer to say "Viewing records 1-15 of 45" etc Thanks
11
3541
by: scsTiger | last post by:
I am using Access 2000 as the front end and MS SQL 2000 as the backend. I have a one record form that I set using something like: strSQL = "SELECT * FROM dbo_WBACCT WHERE (((dbo_WBACCT.ACCOUNT)='"423456"'));" Me.RecordSource = strSQL Obviously I only want one record at a time because the database is very big.
6
2106
by: Ben | last post by:
Hi We have a Dataset that has been populated from the output parameter of a Stored Procedure (@Output). I understand that I can extract a single item when the dataset is populated by a table using this code: CType(objDataSet.Tables("MyTable").Rows(0).Item("MyField"), String)
1
2127
by: Tony Dunn | last post by:
I have inherited another developer's database (Access 2003) and with it a problem I'm struggling with. The problem is this. I have a parent-child form pair, which is populated by a table (the parent) and a query (the child). The two sources are linked by an identical unique number. The table populating the parent uses the number as primary key. The child table has no primary key so it can used one-to-many. Users add data through the form...
10
6943
by: ewankosayo | last post by:
Hi can anyone help me how can i move to the next record? While Reader.Read For Each Row As DataRow In Table.Rows If Reader("UserID") = Row("UserID") Then ' I need to Move to the next Row here.. ' How can i Move to the Next Row? Else Dim Item As New ListViewItem Call Item.SubItems.Add(Reader("Name"))
0
10353
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...
1
10356
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10099
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...
1
7643
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6869
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();...
0
5675
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4314
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
3836
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3003
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.