|
 |
ado_dotnet thread: Reading Single Record
Message #1 by hugh@k... on Wed, 5 Feb 2003 13:09:35
|
|
Hello Everyone and thanks for your help in advance. I am fairly new to
ADO.Net. I have several applications that need to read one record and
then access several of the columns. Could someone show me the most
efficient way. Currently, I am using a datareader and a While...Next
loop but there must be a better way. Thanks.
Message #2 by "Brian Smith" <bsmith@l...> on Wed, 5 Feb 2003 13:11:53 -0000
|
|
There's not really a more efficient method unless you only want a single
value, in which case ExecuteScalar is preferable. But you don't need a
While loop if you know there is only one row you are interested in..
brian
-----Original Message-----
From: hugh@k... [mailto:hugh@k...]
Sent: Wed, 05 Feb 2003 13:10
To: ADO.NET
Subject: [ado_dotnet] Reading Single Record
Hello Everyone and thanks for your help in advance. I am fairly new to
ADO.Net. I have several applications that need to read one record and
then access several of the columns. Could someone show me the most
efficient way. Currently, I am using a datareader and a While...Next
loop but there must be a better way. Thanks.
===
Fast Track ADO.NET with C# is a concise introduction to the concepts,
techniques, and libraries that you will need in order to start using
ADO.NET in your applications. The book covers DataSets and Typed
DataSets, accessing data using DataReaders and DataAdaptors, the close
relationship between ADO.NET and XML, how and where to use ADO.NET in
your enterprise applications, and how to use Web Services and ADO.NET to
easily pass data between applications.
http://www.wrox.com/books/1861007604.htm
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003
Message #3 by hugh@k... on Wed, 5 Feb 2003 17:21:10
|
|
Thanks for your response. How do I get away without the While loop?
> There's not really a more efficient method unless you only want a single
value, in which case ExecuteScalar is preferable. But you don't need a
While loop if you know there is only one row you are interested in..
brian
-----Original Message-----
From: hugh@k... [mailto:hugh@k...]
Sent: Wed, 05 Feb 2003 13:10
To: ADO.NET
Subject: [ado_dotnet] Reading Single Record
Hello Everyone and thanks for your help in advance. I am fairly new to
ADO.Net. I have several applications that need to read one record and
then access several of the columns. Could someone show me the most
efficient way. Currently, I am using a datareader and a While...Next
loop but there must be a better way. Thanks.
===
Fast Track ADO.NET with C# is a concise introduction to the concepts,
techniques, and libraries that you will need in order to start using
ADO.NET in your applications. The book covers DataSets and Typed
DataSets, accessing data using DataReaders and DataAdaptors, the close
relationship between ADO.NET and XML, how and where to use ADO.NET in
your enterprise applications, and how to use Web Services and ADO.NET to
easily pass data between applications.
http://www.wrox.com/books/1861007604.htm
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003
Message #4 by "Dumais, Mike" <mike.dumais@D...> on Wed, 5 Feb 2003 12:28:18 -0500
|
|
If you are using a data-grid (grdOutput) to access the datareader
object
(odr), you can set the source of the datagrid to odr.
For example:
Say you have a data-reader object called odr that you have instantiated
and
populated with your one record.
Also, you have a datagrid called grdOutput.
I use examples like below:
With grdOutput
.DataSource =3D odr
.DataBind()
end With
Hope this helps
Mike Dumais
DSI Laboratories
DB Coordinator
12700 WestLinks Drive
Fort Myers, FL 33913
(xxx) xxx-xxxx
email: mike.dumais@d...
=A0
=A0
-----Original Message-----
From: hugh@k... [mailto:hugh@k...]
Sent: Wednesday, February 05, 2003 12:21 PM
To: ADO.NET
Subject: [ado_dotnet] RE: Reading Single Record
Thanks for your response. How do I get away without the While loop?
> There's not really a more efficient method unless you only want a
single
value, in which case ExecuteScalar is preferable. But you don't need a
While loop if you know there is only one row you are interested in..
brian
-----Original Message-----
From: hugh@k... [mailto:hugh@k...]
Sent: Wed, 05 Feb 2003 13:10
To: ADO.NET
Subject: [ado_dotnet] Reading Single Record
Hello Everyone and thanks for your help in advance. I am fairly new to
ADO.Net. I have several applications that need to read one record and
then access several of the columns. Could someone show me the most
efficient way. Currently, I am using a datareader and a While...Next
loop but there must be a better way. Thanks.
=3D=3D=3D
Fast Track ADO.NET with C# is a concise introduction to the concepts,
techniques, and libraries that you will need in order to start using
ADO.NET in your applications. The book covers DataSets and Typed
DataSets, accessing data using DataReaders and DataAdaptors, the close
relationship between ADO.NET and XML, how and where to use ADO.NET in
your enterprise applications, and how to use Web Services and ADO.NET
to
easily pass data between applications.
http://www.wrox.com/books/1861007604.htm
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003
=3D=3D=3D
Fast Track ADO.NET with C# is a concise introduction to the concepts,
techniques, and libraries that you will need in order to start using
ADO.NET
in your applications. The book covers DataSets and Typed DataSets,
accessing
data using DataReaders and DataAdaptors, the close relationship between
ADO.NET and XML, how and where to use ADO.NET in your enterprise
applications, and how to use Web Services and ADO.NET to easily pass
data
between applications.
http://www.wrox.com/books/1861007604.htm
Confidentiality Notice: This e-mail message, including any attachments,
is
for the sole use of the recipient(s) and may contain confidential and
privileged information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the intended recipient,
please
contact the sender by reply e-mail and destroy all copies of the
original
message.
Message #5 by "Brian Smith" <bsmith@l...> on Wed, 5 Feb 2003 17:58:39 -0000
|
|
myReader.Read() ' once only
' read columns for this first row
textBox1.Text = myReader.GetString(1)
etc.
myReader.Close()
Brian
-----Original Message-----
From: hugh@k... [mailto:hugh@k...]
Sent: Wed, 05 Feb 2003 17:21
To: ADO.NET
Subject: [ado_dotnet] RE: Reading Single Record
Thanks for your response. How do I get away without the While loop?
> There's not really a more efficient method unless you only want a
> single
value, in which case ExecuteScalar is preferable. But you don't need a
While loop if you know there is only one row you are interested in..
brian
-----Original Message-----
From: hugh@k... [mailto:hugh@k...]
Sent: Wed, 05 Feb 2003 13:10
To: ADO.NET
Subject: [ado_dotnet] Reading Single Record
Hello Everyone and thanks for your help in advance. I am fairly new to
ADO.Net. I have several applications that need to read one record and
then access several of the columns. Could someone show me the most
efficient way. Currently, I am using a datareader and a While...Next
loop but there must be a better way. Thanks.
===
Fast Track ADO.NET with C# is a concise introduction to the concepts,
techniques, and libraries that you will need in order to start using
ADO.NET in your applications. The book covers DataSets and Typed
DataSets, accessing data using DataReaders and DataAdaptors, the close
relationship between ADO.NET and XML, how and where to use ADO.NET in
your enterprise applications, and how to use Web Services and ADO.NET to
easily pass data between applications.
http://www.wrox.com/books/1861007604.htm
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003
===
Fast Track ADO.NET with C# is a concise introduction to the concepts,
techniques, and libraries that you will need in order to start using
ADO.NET in your applications. The book covers DataSets and Typed
DataSets, accessing data using DataReaders and DataAdaptors, the close
relationship between ADO.NET and XML, how and where to use ADO.NET in
your enterprise applications, and how to use Web Services and ADO.NET to
easily pass data between applications.
http://www.wrox.com/books/1861007604.htm
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003
|
|
 |