Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

C# usage of ADODataReader Item iterator

I have found that if I have:

ADODataReader dr;

then

dr.Item("Name").ToString();

doesn't work because Item doesn't show up it appears in C#. Is the proper
syntax instead:

dr["Name"].ToString()

since Item is the default iterator?

Can a string like "Name" be used or does it need to be a positional ordinal
like dr[0].ToString()?

Thanks,
[425 byte] By [Chris Kinsman] at [2007-11-9 18:21:29]
# 1 Re: C# usage of ADODataReader Item iterator
Chris, either of these should work:

dr["Name"].ToString();

or

dr[2].ToString();

"Chris Kinsman" <ckinsman@dev-archive.com> wrote in message
news:39957acd$1@news.dev-archive.com...
> I have found that if I have:
>
> ADODataReader dr;
>
> then
>
> dr.Item("Name").ToString();
>
> doesn't work because Item doesn't show up it appears in C#. Is the proper
> syntax instead:
>
> dr["Name"].ToString()
>
> since Item is the default iterator?
>
> Can a string like "Name" be used or does it need to be a positional
ordinal
> like dr[0].ToString()?
>
> Thanks,
>
>
>
>
Gus Perez [MSFT] at 2007-11-11 22:29:24 >
# 2 Re: C# usage of ADODataReader Item iterator
The ADODataReader in the PDC bits is not totally working. What your trying
to do will work with the SQLDataReader but not the ADODataReader with the
PDC bits.

Tom

"Chris Kinsman" <ckinsman@dev-archive.com> wrote in message
news:39957acd$1@news.dev-archive.com...
> I have found that if I have:
>
> ADODataReader dr;
>
> then
>
> dr.Item("Name").ToString();
>
> doesn't work because Item doesn't show up it appears in C#. Is the proper
> syntax instead:
>
> dr["Name"].ToString()
>
> since Item is the default iterator?
>
> Can a string like "Name" be used or does it need to be a positional
ordinal
> like dr[0].ToString()?
>
> Thanks,
>
>
>
>
Tom Kaiser at 2007-11-11 22:30:24 >
# 3 Re: C# usage of ADODataReader Item iterator
Found that out by total chance about three days ago...

It also appears that the various GetXXX() methods off the SQLDataReader may
also have some issues.

"Tom Kaiser" <kaisert@earthlink.net> wrote in message
news:39963c30@news.dev-archive.com...
> The ADODataReader in the PDC bits is not totally working. What your
trying
> to do will work with the SQLDataReader but not the ADODataReader with the
> PDC bits.
>
> Tom
>
>
>
> "Chris Kinsman" <ckinsman@dev-archive.com> wrote in message
> news:39957acd$1@news.dev-archive.com...
> > I have found that if I have:
> >
> > ADODataReader dr;
> >
> > then
> >
> > dr.Item("Name").ToString();
> >
> > doesn't work because Item doesn't show up it appears in C#. Is the
proper
> > syntax instead:
> >
> > dr["Name"].ToString()
> >
> > since Item is the default iterator?
> >
> > Can a string like "Name" be used or does it need to be a positional
> ordinal
> > like dr[0].ToString()?
> >
> > Thanks,
> >
> >
> >
> >
>
>
Chris Kinsman at 2007-11-11 22:31:27 >
# 4 Re: C# usage of ADODataReader Item iterator
THe last time I tried the GetXXX() were working. What seems to be the
problem that your running into?

Tom

"Chris Kinsman" <ckinsman@dev-archive.com> wrote in message
news:399af48d$1@news.dev-archive.com...
> Found that out by total chance about three days ago...
>
> It also appears that the various GetXXX() methods off the SQLDataReader
may
> also have some issues.
>
> "Tom Kaiser" <kaisert@earthlink.net> wrote in message
> news:39963c30@news.dev-archive.com...
> > The ADODataReader in the PDC bits is not totally working. What your
> trying
> > to do will work with the SQLDataReader but not the ADODataReader with
the
> > PDC bits.
> >
> > Tom
> >
> >
> >
> > "Chris Kinsman" <ckinsman@dev-archive.com> wrote in message
> > news:39957acd$1@news.dev-archive.com...
> > > I have found that if I have:
> > >
> > > ADODataReader dr;
> > >
> > > then
> > >
> > > dr.Item("Name").ToString();
> > >
> > > doesn't work because Item doesn't show up it appears in C#. Is the
> proper
> > > syntax instead:
> > >
> > > dr["Name"].ToString()
> > >
> > > since Item is the default iterator?
> > >
> > > Can a string like "Name" be used or does it need to be a positional
> > ordinal
> > > like dr[0].ToString()?
> > >
> > > Thanks,
> > >
> > >
> > >
> > >
> >
> >
>
>
Tom Kaiser at 2007-11-11 22:32:27 >