B
Brian
Using the .ToString method on a SQL 2000 money data type
field of a dataset produces different results depending
on which server I execute the same code against the same
data. In the example below 3 servers produce '14.99' and
1 server produces '14.9900'. OS, Framework version (1.1),
and regional setings of the server appear to be the same
as the others.
Code and results below....
VB.NET Code...
Public Sub BuildLoadItemArray(ByVal Rows As
DataRowCollection)
Dim drRow As DataRow
Dim sbText As New StringBuilder(vbCrLf)
For Each drRow In Rows
'Added to not show 8.97 items in categories other
than ESAL (11)
If CategoryID = 11 OrElse drRow.Item
("Price").ToString <> "8.97" Then
With drRow
sbText.Append(" If (SortID = 1) Or (dPrice
= " & .Item("Price").ToString & "D) Then" & vbCrLf)
sbText.Append(" With uItemRecord" & vbCrLf)
sbText.Append(" .ItemID = " & .Item
("ItemID").ToString & vbCrLf)
sbText.Append(" .ItemName = """ & .Item
("Name").ToString.Trim.Replace("""", """""") & """" &
vbCrLf)
sbText.Append(" .Price = " & .Item
("Price").ToString & "D" & vbCrLf)
sbText.Append(" .ThumbnailImage = """
& .Item("ThumbnailImage").ToString.Trim & """" & vbCrLf)
sbText.Append(" .PartNumber = """ & .Item
("PartNo").ToString.Trim & """" & vbCrLf)
sbText.Append(" End With" & vbCrLf &
vbCrLf)
sbText.Append(" ItemArray.Add
(uItemRecord)" & vbCrLf)
sbText.Append(" End If" & vbCrLf & vbCrLf)
Application.DoEvents()
End With
End If
Next drRow
LoadItemArray = sbText.ToString
End Sub
--------------------------
Results...
1 server produces...
If (SortID = 1) Or (dPrice = 14.9900D) Then
With uItemRecord
.ItemID = 2877
.ItemName = "SLED COFFEE TABLE"
.Price = 14.9900D
.ThumbnailImage = "tn_33028.jpg"
.PartNumber = "33028"
End With
ItemArray.Add(uItemRecord)
End If
3 servers produce..
If (SortID = 1) Or (dPrice = 14.99D) Then
With uItemRecord
.ItemID = 2877
.ItemName = "SLED COFFEE TABLE"
.Price = 14.99D
.ThumbnailImage = "tn_33028.jpg"
.PartNumber = "33028"
End With
ItemArray.Add(uItemRecord)
End If
field of a dataset produces different results depending
on which server I execute the same code against the same
data. In the example below 3 servers produce '14.99' and
1 server produces '14.9900'. OS, Framework version (1.1),
and regional setings of the server appear to be the same
as the others.
Code and results below....
VB.NET Code...
Public Sub BuildLoadItemArray(ByVal Rows As
DataRowCollection)
Dim drRow As DataRow
Dim sbText As New StringBuilder(vbCrLf)
For Each drRow In Rows
'Added to not show 8.97 items in categories other
than ESAL (11)
If CategoryID = 11 OrElse drRow.Item
("Price").ToString <> "8.97" Then
With drRow
sbText.Append(" If (SortID = 1) Or (dPrice
= " & .Item("Price").ToString & "D) Then" & vbCrLf)
sbText.Append(" With uItemRecord" & vbCrLf)
sbText.Append(" .ItemID = " & .Item
("ItemID").ToString & vbCrLf)
sbText.Append(" .ItemName = """ & .Item
("Name").ToString.Trim.Replace("""", """""") & """" &
vbCrLf)
sbText.Append(" .Price = " & .Item
("Price").ToString & "D" & vbCrLf)
sbText.Append(" .ThumbnailImage = """
& .Item("ThumbnailImage").ToString.Trim & """" & vbCrLf)
sbText.Append(" .PartNumber = """ & .Item
("PartNo").ToString.Trim & """" & vbCrLf)
sbText.Append(" End With" & vbCrLf &
vbCrLf)
sbText.Append(" ItemArray.Add
(uItemRecord)" & vbCrLf)
sbText.Append(" End If" & vbCrLf & vbCrLf)
Application.DoEvents()
End With
End If
Next drRow
LoadItemArray = sbText.ToString
End Sub
--------------------------
Results...
1 server produces...
If (SortID = 1) Or (dPrice = 14.9900D) Then
With uItemRecord
.ItemID = 2877
.ItemName = "SLED COFFEE TABLE"
.Price = 14.9900D
.ThumbnailImage = "tn_33028.jpg"
.PartNumber = "33028"
End With
ItemArray.Add(uItemRecord)
End If
3 servers produce..
If (SortID = 1) Or (dPrice = 14.99D) Then
With uItemRecord
.ItemID = 2877
.ItemName = "SLED COFFEE TABLE"
.Price = 14.99D
.ThumbnailImage = "tn_33028.jpg"
.PartNumber = "33028"
End With
ItemArray.Add(uItemRecord)
End If