bloke
04-29-2003, 08:46 AM
Ok, here goes. I'm putting a recordset into a 2d array using getrows(). When I write out the values of the array, some of the fields come back as null. However, if I simply write out the values from the recordset, the correct values are returned. Any clues?!
If you need any further info, let me know.
Cheers
bloke
blokeinthekitchen.com
bloke
04-30-2003, 02:58 AM
<%
'function to return 'null' if empty or null:
Function valNull(valIn)
If valIn = "" or IsNull(valIn) Then
valNull = "null"
Else
valNull = valIn
End If
End Function
'Array to hold titles:
TitleArray = array("Id","Project", "Location", "Client", "Main Contractor", "Contractor", "Contract", "Programme", "Specification", "Scope", "Method")
'get recordset, add to array and write out in loop
strgetproject = "sp_LAM_get_project_details '"
strgetproject = strgetproject & request.form("projtitle") & "'"
set connection = server.createobject("adodb.connection")
connection.open gstrConn
set objRS = server.createobject("adodb.recordset")
objRS.Open strgetproject ,connection
Dim strvalues
strvalues = objRS.GetRows()
Dim iRowLoop, iColLoop
For iRowLoop = 0 to UBound(strvalues, 2)
For iColLoop = 1 to UBound(strvalues, 1)
If valNull(cstr(strvalues(iColLoop, iRowLoop))) = "null" Then
Else
Response.Write "<tr valign='top'><td bgcolor='#003399' class='whiteheader' width='20%'>"&titlearray(iColLoop)&":</td><td class='projectbody' bgcolor='#ffffff'>"&valNull(cstr(strvalues(iColLoop, iRowLoop)))&"</td></tr>"
End If
Next 'iColLoop
Next 'iRowLoop
objRS.movefirst
%>
For some reason, it writes out some values but not others. If I simply write the field out using, say, <%=objRS("projmaincontractor")%>, then all is well.
Confused!
ps - I'm using sql server 2000 and I've tried using various datatypes, text, ntext, varchar, nvarchar - all with the same result.
bloke
blokeinthekitchen.com