Re: DataTable
From: Wal Turner (vooose_at_hotmail.com)
Date: 10/19/04
- Next message: Larry P.: "Re: opengl in c#"
- Previous message: Joe: "Convert proxy type to class type"
- In reply to: Ignacio Machin \( .NET/ C# MVP \): "Re: DataTable"
- Next in thread: Stefan Simek: "Re: DataTable"
- Reply: Stefan Simek: "Re: DataTable"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 20 Oct 2004 08:49:36 +1000
Thank you for your reply. Unfortunately I cannot give a specific example as
the bug seems to occur randomly. The select statement (or WHERE clause) is a
simple filter, eg "TradeID=" + x
which works as expected most of the time. I guess the unusual thing here is
that dataTable.Select( ) is returning a null row - I've read the
documentation for DataTable and it would seem by definition if its returning
a row then that row can't be null!
I guess the (sql) analogy here is doing a select statement and having
count(*) = 1 but then when you actually get the row in question it doesnt
exist!
Regards
Wal
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:OMwsBAetEHA.1216@TK2MSFTNGP10.phx.gbl...
> Hi,
>
> > I am using the System.Data.DataTable class which I have heard may
display
> > some unusual behaviour.
>
> Like?
>
> > I am doing
> >
> > DataRow[] dr = dataTable.Select(sql);
> >
> > The sql in this instance doesnt matter -
>
> In general it DOES , the sql is not a SELECT clause from sql, but a
filter
> expression ( like the WHERE clause in SQL )
>
> > what is important is that dr.Length
> > is greater than 0, implying there is at least one result.
> > However I discovered that sometimes this method was returning dr.Length
=
> 1
> > when I thought it should return 0 rows. In fact, the dataTable contents
> > reflected it returning 0 rows but it chose to return one anyway!
> >
> > Further inspection showed this DataRow to be null, ie dr[0] == null
> >
> > Has anyone come across this similar problem?
>
> Nop, please try to post a complete example where this happen, if possible
> with the table definition, etc it may be a bug after all.
>
>
> cheers,
>
> --
> Ignacio Machin,
> ignacio.machin AT dot.state.fl.us
> Florida Department Of Transportation
>
>
>
- Next message: Larry P.: "Re: opengl in c#"
- Previous message: Joe: "Convert proxy type to class type"
- In reply to: Ignacio Machin \( .NET/ C# MVP \): "Re: DataTable"
- Next in thread: Stefan Simek: "Re: DataTable"
- Reply: Stefan Simek: "Re: DataTable"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|