+2  A: 

If you, instead of selecting everything (*), selects the required columns - do you still have the same problem? I.e:

SELECT gID, iDesc, iLength, iQty 
FROM shopitems
WHERE catID = 22
Björn
Yep, tried that, same problem still
Phsion
Nevermind, i'm an idiot, i thought i tried that but i left some debugging code in on accident which lied to me...Works perfect
Phsion
Any reason why this would Fix it?
Phsion
First now that you've removed the debugging code put the * back and confirm its yet again broken, then put the specific fields in to confirm that fixes it (and it is the correct approach).
AnthonyWJones
Nah, its all kinds of broken again...i tried changing to sqltxt in the actual app, and its still broken, so then i tried the test page again, and now its broken too...so i slowly removed fields from the SELECT statement one at a time, and when i got down to two, it worked (kinda)
Phsion
OK...so i have "select iDesc, gID from ShopItems order by gID asc" now. If i comment out {gID=rs1("gID")} then i get a value for iDesc. If i don't comment out the gID line, then i don't get iDesc.
Phsion
+2  A: 

Add Option Explicit at the top (within <% and %>) to make variable declaration required, then declare your variables using Dim variable-name-goes-here for all your variables, and voila, you will see the problem right away.

svinto
+1, I didn't see your answer. I think it's a far better solution than just giving the solution right away like I did so I removed my answer.
ybo
+1  A: 

This is a confusing problem. Like mentioned, be sure to turn on option explicit to help find any variable name issues. If you have used On Error Resume Next then you can use On Error Goto 0 to make sure you aren't suppressing errors

Here is my take. Break this into it's own file if you can for debugging. If my loop produces output we can track things down.

<%
Option Explicit
On Error Goto 0

Dim db1, sqltxt, rs1
Dim gID, iLength, iDesc, arrRS

Set db1 = Server.CreateObject("ADODB.Connection")
'db1.Open "Provider=MSDASQL;Driver={SQL Server};Server=Phsion;Database=master;"
db1.Open "Provider=MSDASQL;DSN=SHOPWEB;"
'sqltxt="select gID, iLength, iDesc from shopitems where catID=45 order by CAST(idesc as varchar)"


'   sqltxt="select iDesc, gID from ShopItems order by gID asc"
'   set rs1=db1.execute(sqltxt)
'   rs1.movefirst
'   do until rs1.eof
'    gID = rs1("gID")
'    'iLength=rs1("iLength")
'    iDesc = rs1("iDesc")
'    response.write("gID: " & gid & "")
'    response.write("iLength: " & iLength & "")
'    response.write("iDesc: " & iDesc & "")
'    rs1.movenext
'   loop
'   rs1.close : set rs1=nothing

sqltxt="select iDesc, gID from ShopItems order by gID asc"
set rs1=db1.execute(sqltxt)
'//Dump the recordset into an array
arrRS = rs1.GetRows()
'//We can close the rs now since we don't need it anymore
rs1.close : set rs1=nothing

'//We are going to basically dump a HTML table that should look like you SQL viewer
Response.Write("<table>")
'//Loop through all the rows
For i = 0 To UBound(arrRS,2)
    Response.Write("<tr>")
    '//Loop through all the columns
    For j = 0 To UBound(arrRS,1)
      '//write out each column in the row
      Response.Write("<td>" & arrRS(j,i) & "</td>")
      '//Look I will be honest, I can't test this so your might have to swap the i and the j to get a full output
    Next
    Response.Write("</tr>")
Next
Response.Write("</table>")

db1.close : set db1=nothing
%>
MrChrister
OK...so yes, that works...on a side note, when i got overly frustrated, i upgraded from sql 2000 to 2005. I still had the problem though...So what is my code doing thats so wacky? Does SQL not believe me when I say I want everything out of the Database? Thanks!
Phsion
Oh, yes, your code was fine...except Option Explicit is still a pain in the ass, since 'i' and 'j' wern't declared
Phsion
I am not too sure. I would have to guess that it was a conflict between a variable used before the loop. Your code as presented gave me no problems at all that I could tell, so it must be something else.
MrChrister
Did you use Option Explicit and DIM i and j, or did you stop using Option Explicit?
MrChrister
A little from column A, a little for column B...i used option explicit for laughs
Phsion
Seems kinda like there is something between how the ADO object gets the info, and some difference between the JET DB driver and the SQL DB driver...all the info is there...if i use one method, i see the info, if i use another, i dont...where is the 'SQL Stop Trying To Make Me Faster' button?
Phsion
A: 

I don't know if you've fixed this yet, but if not then you should try changing the order you select your columns so that the nText field goes at the end. There is a technical explanation for this (something to do with the maximum byte-length of a record, iirc).

Cirieno