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:
Dim CDrs, CDdc
Dim obj, result
If (0 <> orderrunid) Then
rv = Something...
rv = ""
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 & ","
objelms = objelms & toJSON(obj)
Set CDrs = Nothing
Set CDdc = Nothing
Set obj = Nothing
result = "[" & objelms & "]"
UnassignedDropList = result
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