PDA

View Full Version : recordset gets some data but not all??


Spudhead
08-22-2006, 12:56 PM
set oDB = new databaseInterface
aStoryInfo = oDB.QuerySQL("SELECT [id], [title], [bodycopy], [image], [summary], [author] FROM [" & tblStories & "] WHERE [id]=" & iStoryID)
set oDB = nothing
if isArray(aStoryInfo) then
sStoryTitle = safeUnescape(aStoryInfo(1,0))
sBodyCopy = safeUnescape(aStoryInfo(2,0))
sImageURL = aStoryInfo(3,0)
sSummary = safeUnescape(aStoryInfo(4,0))
sAuthor = safeUnescape(aStoryInfo(5,0))
debug "*" & sBodyCopy & "*"
end if


ok so I'm using a functions library, most of which is irrelevant. databaseInterface is just a bunch of functions for connecting to the database and stuff, aStoryInfo is populated with a data array that's a result of an ADODB.Recordset "getRows()" method. safeUnescape and debug are pretty straightforward but for reference they are:


function debug(s)
response.write(s & "<br/>" & vbCrLf)
response.end
end function

function safeUnescape(str)
dim rv : rv = ""
if str & "" <> "" then rv = unescape(str)
safeUnescape = rv
end function



So: my problem. Is weird. Two of those data variables (sImageURL and sBodyCopy ) don't get populated.

I've run the generated SQL direct against the database (in Query Analyser) and I KNOW there's data in those fields. One big chunk of text, and one image filename. The database fields themselves are nothing special; a text(16) and an nvarchar(150).

I'm at a complete loss. Either you get a row full of data back or you don't. You never get a little bit. There are no errors, nothing else weird. I just don't get two fields.

Spudhead
08-22-2006, 04:56 PM
Right. I have a cause, but not a solution.

It's text fields. Any field that comes after a text field is... missed.

I have two text fields in that particular query: "summary" and "bodycopy". I can move them round and see this in effect. If I put them both at the end, I get every other field but not the one that's last in the query.

Now, the funny thing is, I'm sure I've seen this before. But Google doesn't appear to have done, and I'm stumped as to how to debug it.

As for solving it... only thing I can think of at the moment is to use a query for each of the text fields and a query for everything else. Which is as inelegent a solution as I can imagine.

Can anyone shed any further light on this?