473,769 Members | 2,143 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

idatareader?

js
Hi, I want to debug the return idatareader, how to print out some fields
value? many thanks.
Apr 17 '06 #1
3 2367


Unforunately, there isn't a clean cut way to see the values in the debugger.

i'm typing this from memory, but should get you started ..........

it probably has some syntax errors, but should be correctable.
public void ShowDataReaderV alues( IDataReader idr)
{
bool keepChecking = true;
int counter = 0;

if (null != idr)
{
while (idr.Read())
{
while keepChecking = true;
{
if (!idr.IsDBNull( counter))
{
object o = idr.GetValue(co unter++);
Console.WriteLi ne (o.ToString());
}

if (counter>idr.De pth)
{
keepChecking=fa lse;
}

}

}

}


"js" <js@so*****@hot mail.com> wrote in message
news:uG******** ******@TK2MSFTN GP05.phx.gbl...
Hi, I want to debug the return idatareader, how to print out some fields
value? many thanks.

Apr 17 '06 #2
js
thanks sloan...

"sloan" <sl***@ipass.ne t> wrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..


Unforunately, there isn't a clean cut way to see the values in the
debugger.

i'm typing this from memory, but should get you started ..........

it probably has some syntax errors, but should be correctable.
public void ShowDataReaderV alues( IDataReader idr)
{
bool keepChecking = true;
int counter = 0;

if (null != idr)
{
while (idr.Read())
{
while keepChecking = true;
{
if (!idr.IsDBNull( counter))
{
object o = idr.GetValue(co unter++);
Console.WriteLi ne (o.ToString());
}

if (counter>idr.De pth)
{
keepChecking=fa lse;
}

}

}

}


"js" <js@so*****@hot mail.com> wrote in message
news:uG******** ******@TK2MSFTN GP05.phx.gbl...
Hi, I want to debug the return idatareader, how to print out some fields
value? many thanks.


Apr 17 '06 #3

Since I put the wrong Property.. I fixed it.. (and since you were nice
enough to say thank you)

Here is a version that works "out of the box".

(Don't forget to .Close() those datareaders as soon as you're done with them
!! )

public void ShowDataReaderV alues( IDataReader idr)

{

bool keepChecking = true;

int counter = 0;

bool resultSetExists = true;//assume at least 1 result set

if (null != idr)

{

while (resultSetExist s)

{

while (idr.Read())

{

keepChecking = true;//reset

counter=0;//reset

Console.WriteLi ne ("------------------------------");

while (keepChecking == true)

{

if (!idr.IsDBNull( counter))

{

object o = idr.GetValue(co unter++);

Console.WriteLi ne (o.ToString());

}

if ( counter>=idr.Fi eldCount )

{

keepChecking=fa lse;

}

}

}

resultSetExists = idr.NextResult( ); // this will figure out if there is
another result set

}

}

}


"js" <js@so*****@hot mail.com> wrote in message
news:eH******** *****@TK2MSFTNG P02.phx.gbl...
thanks sloan...

"sloan" <sl***@ipass.ne t> wrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..


Unforunately, there isn't a clean cut way to see the values in the
debugger.

i'm typing this from memory, but should get you started ..........

it probably has some syntax errors, but should be correctable.
public void ShowDataReaderV alues( IDataReader idr)
{
bool keepChecking = true;
int counter = 0;

if (null != idr)
{
while (idr.Read())
{
while keepChecking = true;
{
if (!idr.IsDBNull( counter))
{
object o = idr.GetValue(co unter++);
Console.WriteLi ne (o.ToString());
}

if (counter>idr.De pth)
{
keepChecking=fa lse;
}

}

}

}


"js" <js@so*****@hot mail.com> wrote in message
news:uG******** ******@TK2MSFTN GP05.phx.gbl...
Hi, I want to debug the return idatareader, how to print out some fields value? many thanks.



Apr 17 '06 #4

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

Similar topics

5
1979
by: Tamir Khason | last post by:
As far as I understand, IDataReader, based on command recieves isClosed property when the connection closes. How to prevent it?
2
11752
by: Vivek Sharma | last post by:
Hi There, can some one please clarify the difference between SQLDataReader and IDataReader? What are the advantages and disadvantages of each? Thanks Vivek
5
7038
by: Gelios | last post by:
Hello All! I am going to crazy and feeling myself so stupid but I don't understand such behaviour. I have code: public int getNextAgentId() { Int32 agent_id = 0; IDataReader dr = dbap.DBDataReader("SELECT MAX(agent_id) FROM Agents"); if(dr.Read()) { agent_id = dr.GetInt32(0);
4
4601
by: Mahesh Kumar.R | last post by:
What is the difference between SqlDataReader and IDataReader ...? kindly with small example... Mahesh~
2
1566
by: יוני גולדברג | last post by:
Hi, In few places within my code the business object pass IDataReader to the GUI. Suddenly i noticed that nowhere in the code the IDataReader is being closed. Does the data binding operation closes the IDataReader? If i didn't close it explicitly, the IDataReader remains open untill GC will clean it?
2
2088
by: Larry R | last post by:
Whenever I try the following, the reader that is returned is always closed. What am I missing ? When I look at the reader in the ExecuteReader, it is fine. THen it gets closed on the returm. Thanks! ============================
0
1315
by: rsdev | last post by:
Hi, I am new to ASP.NET and I am trying to build a CMS application using theBeerHouse SK. I am adapting the Datareader to collect information from an SQL database and send it to an HtmlHeader. Using N-Tier architecture I keep recieving an object reference required error. Here's my code: Home.aspx.cs
2
2868
by: RP | last post by:
I saw a code in a class where IDataReader is used to retrieve result from query, even if only one column is to be retrieved. It uses a CommandObject with ExecuteReader but not using ExecuteScalar. For what IDataReader is used and what are the benefits of it as compared to sime DataReader.
0
1174
by: Andrus | last post by:
RDLDesigner report designer requires IDataReader for data access. To use it with Linq, I need to convert Linq projection to IDataReader. var db = new NorthwindContext(); var q = from c in db.Customers select new { c.ContactName, c.City }; IDataReader dr = QueryDataReader( db, q );
0
9579
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
9422
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
10208
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...
1
7404
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
6662
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
5294
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3952
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
3558
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.