ColumnEnum was just an example of an enum you would create to access the
columns in your SqlDataReader
enum ColumnEnum
{
Id, Category, etc
}
this way you are accessing the columns by their int index, rather than their
name, which is obviously faster.
"Arjen" <(E-Mail Removed)> wrote in message
news:bg834s$62h$(E-Mail Removed)...
> When I search for your best practice with google.com I don't find al lot
of
> material.
>
> http://www.google.nl/search?hl=nl&ie...ColumnEnum&lr=
>
> What namespace do I have to use for ColumnEnum?
>
> Thanks!
>
>
>
> "PJ" <(E-Mail Removed)> schreef in bericht
> news:#(E-Mail Removed)...
> > the .Read() method returns false if it has reached the end of it's
record
> > stream so your code should be
> >
> > if ( dr.Read() )
> > {
> > //perform actions on row
> > }
> >
> > and...btw, use enums rather than strings to access your columns...it's
> > quicker
> >
> > if ( (string)dr[Convert.ToInt32(ColumnEnum.Category)] == "xmlsrc" )
> > //...
> >
> > "Arjen" <(E-Mail Removed)> wrote in message
> > news:bg7ufi$mro$(E-Mail Removed)...
> > > Hello,
> > >
> > > How can I check the recordcount?
> > >
> > > Here is a little bit of my code:
> > > // Load first row into Datareader
> > > dr.Read();
> > >
> > > if (dr["Category"].ToString() == "xmlsrc") {
> > >
> > > When I do this I get an error because there is no data... it only have
> to
> > > check this dr["Category"].ToString() == "xmlsrc") if there is data.
> > > How can I do that?
> > >
> > > Thanks!
> > >
> > >
> >
> >
>
>