473,508 Members | 4,324 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.NextRecord() , it is
possible. Is the following code correct?

My code ::
System.Data.SqlClient.SqlDataReader d1;

private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here

}

private void Button1_Click(object sender, System.EventArgs e)
{

sqlCommand1.Parameters["@a"].Value=txtC.Text;
sqlConnection1.Open();
d1= sqlCommand1.ExecuteReader();
do
{

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

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

Similar topics

5
9455
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...
2
10111
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,...
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...
10
5281
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
3515
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...
6
2091
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...
1
2112
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...
10
6903
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 ...
0
7128
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...
0
7393
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...
1
7058
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...
0
7502
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...
0
5635
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,...
0
4715
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...
0
3191
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
426
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...

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.