Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / ADO.NET / September 2005

Tip: Looking for answers? Try searching our database.

Does ExecuteReader allow you to return a record name?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Steve1 - 29 Sep 2005 10:48 GMT
Hi all,

I''ve created an OleDbDataReader that will contain the number of records that
the used SQL query will return.  I'm then using a while loop to loop while
the OleDBDataReader object has records.  I would like to know does the
OleDbDataReader contain the actual information on each record i.e. the fields
in the database and their values?  Or does the ExecuteReader command only
contain the number of records present from the used SQL query and no more?
Or am I going the completely wrong way about it??

I need to use the 'Name' field's value of the current OleDbDataReader record
in a following (not present in code snippit) code block.  I using an Access
2000 database.  Thanks in advance, Steve.

OleDbDataReader obj_ReaderLayoutsPound = obj_SQLLayoutsPound.ExecuteReader();
while( obj_ReaderLayoutsPound.Read())
{
         // Is there a property of the OleDbDataReader that will contain the
information of each record?
         string str_CurrentRecord = obj_ReaderLayoutsPound.ToString();
}
cecil - 29 Sep 2005 21:16 GMT
The DataReader contains the result set of the Query in the command
object used to create it.  The DataReader has no information on the
underlying tables that may have been accessed by the query.  If the
field is in the select statemant you can access it:

str = (string)dr["Name"];
Or better
str = dr.GetStringValue(0); // where 0 is the index of the field
according to the select statement.

I hope I answered your question though I am not sure if I understood
the question.

Cecil Howell
MCT, MCSD, MCAD.NET, MCGFRD.NET

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.