PC Review


Reply
Thread Tools Rating: Thread Rating: 1 votes, 1.00 average.

Datatable.compute(value) returns (Null) when it shouldn't

 
 
=?Utf-8?B?QW5kcmV3IENhcmxzb24=?=
Guest
Posts: n/a
 
      4th Aug 2005
I am trying to add the values of a column together where the row meets the
correct criteria. I get inconsistant results and I cannot reason why. Below
is the code.

For x = 0 to dsStations.Table(0).Rows.Count -1
Dim Total As Object = dsTemp.Tables(0).Compute("SUM(MCFAUDIT)", "LSENUM = "
& StationID)
dsStations.Table(0).rows(x).item("Caluclated Result") = Total
Next

Where MCFAUDIT is the column to add, and the row is reporting from the
requested station. LSENUM = StationID.

I am running this against a 700 or so stationID's and for the most part it
works great. However, sometimes I get a value of nothing. Which is odd
because if I manually look at the data, I see that it is all there. The
datatype of the column being calculated is int32. I can see no changes, there
are no odd characters that are making any of the columns referenced into a
string datatype. Everything is numeric, however, I don't see how that would
matter for the stationID filter.

Any ideas why some calls return nothing when the data is there?


 
Reply With Quote
 
 
 
 
=?Utf-8?B?QW5kcmV3IENhcmxzb24=?=
Guest
Posts: n/a
 
      4th Aug 2005

I figured it out. I did not wrap the stationID in single quotes. It is
apparently a string property. Thus the following:
Dim Total As Object = dsTemp.Tables(0).Compute("SUM(MCFAUDIT)", "LSENUM =' "
& StationID & "'")

returns all the results correctly.

I hate that!

"Andrew Carlson" wrote:

> I am trying to add the values of a column together where the row meets the
> correct criteria. I get inconsistant results and I cannot reason why. Below
> is the code.
>
> For x = 0 to dsStations.Table(0).Rows.Count -1
> Dim Total As Object = dsTemp.Tables(0).Compute("SUM(MCFAUDIT)", "LSENUM = "
> & StationID)
> dsStations.Table(0).rows(x).item("Caluclated Result") = Total
> Next
>
> Where MCFAUDIT is the column to add, and the row is reporting from the
> requested station. LSENUM = StationID.
>
> I am running this against a 700 or so stationID's and for the most part it
> works great. However, sometimes I get a value of nothing. Which is odd
> because if I manually look at the data, I see that it is all there. The
> datatype of the column being calculated is int32. I can see no changes, there
> are no odd characters that are making any of the columns referenced into a
> string datatype. Everything is numeric, however, I don't see how that would
> matter for the stationID filter.
>
> Any ideas why some calls return nothing when the data is there?
>
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
datatable.compute Chuck Hecht Microsoft Dot NET Compact Framework 1 28th Aug 2007 03:45 AM
DataTable.Compute() question SpaceMarine Microsoft Dot NET Framework 5 22nd Aug 2007 08:41 AM
DataTable.Compute() question SpaceMarine Microsoft ADO .NET 5 22nd Aug 2007 08:41 AM
DataTable Compute Method =?Utf-8?B?QW5kcmVpd2lk?= Microsoft ADO .NET 1 8th Nov 2005 07:01 PM
datatable.compute method =?Utf-8?B?RGF2aWQgQW5kZXJzb24=?= Microsoft Dot NET 1 8th Jun 2005 11:16 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:18 PM.