Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 getrows() omits fields

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-11-05 : 00:18:39
Derek writes "Getrows() seems to work differently between Access 2000 and SQL Server 7 sp 2.

In Access the code below will display every field from every row. Using the same data but on an SQL Server it only displays the first and last fields and the rest are empty. If I don't use getrows but a conventional movenext/loop routine I can access and display all fields values from all rows.

sconnq="DSN=someSQLdb;UID=u;PWD=p"
set oRS=server.createobject("ADODB.recordset")
thissql="select * from mytable;"
oRS.open thisSQL, sconnq
thisresults=oRS.getrows()
recs=ubound(thisresults,2)
fields=ubound(thisresults,1)
oRS.close
set oRS=nothing
for r=0 to recs
response.write "[" & r & "]"
for f=0 to fields
response.write thisresults(f,r) & "/"
next
next


for example if a record contains five fields with values "a", "b", "c", "d", "e" then
Access will produce
[0]a/b/c/d/e

SQL server will produce
[0]a////e

Thanks"
   

- Advertisement -