Some non-null fields being returned as null?

Some non-null fields being returned as null?

Post by Damo » Sat, 01 Sep 2007 11:20:53

I'm about ready to pull my hair out on this one. I'm working on a
medium-large mapping web site for a client. Part of the code reads a
set of about 15 fields from a table in the database. The first time
through (to pick up the "unassigned" orders), I get all of the data
with no problems. The second time through (to pick up the orders
allocated to delivery routes), some of the fields are returned as NULL
even though they're not in the database!!! In particular, the postal
code, the latitude and longitude. WHY?? WHAT'S GOING ON!???

A simplified version of my code:

Function DropList(orderrunid)
Dim CDrs, CDdc
Dim obj, result
Dim objelms
Dim rv

If (0 <> orderrunid) Then
rv = Something...
rv = ""
End If

Set obj = Server.CreateObject("Scripting.Dictionary")
Set CDdc = Server.CreateObject("ADODB.Connection")
CDdc.Open "connection string..."
SQL = "SELECT * FROM GlobalOrders WHERE OrderRunID=" & _
CStr(orderrunid) & " AND Latitude <> 0 AND Longitude <> 0"
Set CDrs = CDdc.Execute(SQL)

objelms = ""

Do While (Not CDrs.EOF)
obj.Add "orderid", CInt(CDrs("OrderID"))
obj.Add "orderrunid", CInt(CDrs("OrderRunID"))
obj.Add "postcode", CStr(CDrs("OrderCustomerPostcode"))
(a bunch of other fields here...)
obj.Add "latitude", CDbl(CDrs("Latitude"))
obj.Add "longitude", CDbl(CDrs("Longitude"))

If ("" <> objelms) Then
objelms = objelms & ","
End If

objelms = objelms & toJSON(obj)



Set CDrs = Nothing
Set CDdc = Nothing
Set obj = Nothing

result = "[" & objelms & "]"

UnassignedDropList = result
End Function

Ready for the worst part? This works fine on my development machine
(Windows XP Pro with IIS 5.1) but has the problem on the client's
production machine!



Some non-null fields being returned as null?

Post by Bob Barrow » Sat, 01 Sep 2007 20:40:26

What database? Type and version please

Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the