|
| |
|
|
yogaboy
Posts: 377 Joined: 5/22/2004 Status: offline
|
GetRows doesn't geddit! - 2/9/2005 6:55:42
I've upsized an Access 2003 database into the SQL Desktop Engine on my local box. Finally got the DSN set up (couldn't get the OLEDB to work) and started pulling out data - but it would only get the first few cols of data, then nothing till the last few. I've done a little bit of tinkering, and it seems that if I use myRS("FieldName"), instead of putting the recordset into an array using GetRows, then I get all the data. Does anyone know why this would happen? Here is some code...
'###############
'the connection
Dim myConn
Set myConn = Server.CreateObject("ADODB.Connection")
myConn.CommandTimeout = 0
myConn.Open "accountsSQL"
'################
'the sql statement
SELECT * FROM ByteIt_Journal WHERE ([DateActioned] BETWEEN '01-Sep-2004' AND '31-Dec-2004') ORDER BY DateActioned DESC
'#################
'getrows
alldata=myRS.getrows
numcols=ubound(alldata,1)
numrows=ubound(alldata,2)
myRS.Close
Set myRS = Nothing
myConn.Close
Set myConn = Nothing
'#####################
'outputting the data
For i = 0 to numrows
Response.write "<tr>"
For j = 0 to numcols
response.write "<td class='tds'>"
If alldata(j,i) <> "" then
thisfield = alldata(j,i)#
Response.write thisfield
Else
Response.write " "
End If
Response.write "</td>"
Next
Response.write "</tr>"
Next Here is the quick alternative to GetRows to test the recordset - this works for any field
While NOT myRS.EOF
Response.write "<tr>"
For i = 0 to myRS.Fields.Count - 1
Response.write "<td>: " & myRS(i).value & "</td>"
Next
myRS.MoveNext
Response.write "</tr>"
Wend
In the words of Penelope Pitstop - Hayulp!
|
|
|
|
rdouglass
Posts: 9228 From: Biddeford, ME USA Status: offline
|
RE: GetRows doesn't geddit! - 2/9/2005 14:00:21
quote:
'############### 'the connection Dim myConn Set myConn = Server.CreateObject("ADODB.Connection") myConn.CommandTimeout = 0 myConn.Open "accountsSQL" '################ 'the sql statement SELECT * FROM ByteIt_Journal WHERE ([DateActioned] BETWEEN '01-Sep-2004' AND '31-Dec-2004') ORDER BY DateActioned DESC '################# 'getrows alldata=myRS.getrows .... This to me just looks wrong and/or incomplete. Where is the SQL called? I'd do it like this: <% mySQL = "SELECT * FROM ByteIt_Journal WHERE ([DateActioned] BETWEEN '01-Sep-2004' AND '31-Dec-2004') ORDER BY DateActioned DESC" myDSN = "DSN=XXX;uid=XXX;pwd=XXX;database=XXX" set conntemp=server.createobject("adodb.connection") conntemp.open myDSN set rstemp=conntemp.execute(mySQL) IF rstemp.eof THEN response.write ("ERROR IN:" & mySQL) rstemp.close set rstemp=nothing conntemp.close set conntemp=nothing ELSE alldata=rstemp.getrows 'Do your stuff END IF %> See with what you posted, I don't see where you're "feeding" the SQL. Also you're introducing myRS.getrows when you're using myConn.Open with the SQL. Is that any help?
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
rdouglass
Posts: 9228 From: Biddeford, ME USA Status: offline
|
RE: GetRows doesn't geddit! - 2/11/2005 10:05:28
A quick check: If you change your SQL query to be just the COUNT of those records, do you get the same count for each (getrows vs. RS)? How 'bout all records (SELECT * FROM table)? Do you get the same results?
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
rdouglass
Posts: 9228 From: Biddeford, ME USA Status: offline
|
RE: GetRows doesn't geddit! - 2/11/2005 16:29:58
quote:
I'm just going to ditch GetRows Maybe you should for the moment, but not altogether. Is there maybe some character(s) in the results that are causing ASP to choke? Cause if you're getting the same COUNT values, the connection (and GetRows) method must be OK. And to be honest, I use getrows all the time and have never run up against that prob.
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|