WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

ADO DAO
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

GetRows Array Results Explained

 Keywords:  GetRows Array SafeArray Results Row Column 

Question:

There seems to be a oddity with the way wbt handles the ADO recordset GetRows method. Looking around the internet, it seems everyone agrees that the GetRows array is indexed [column,row]. Google for "ADO GETROWS" for dozens of references.

However, when used in winbatch, it's pretty clearly indexed [row,colum], as shown in the code below.

This makes no sense to me. How could it conceivably be different? I doubt the winbatch developers put in a special hook to transpose the result of GetRows!

  dbcon1 = 'DRIVER={SQL Server};SERVER=SQL2000;UID=user;PWD=pass;DATABASE=G;ConnectionTimeout=180'

  oADO = ObjectOpen("ADODB.Connection")
  oADO.Open(dbcon1)

  s =   " select 10, 11, 12 union"
  s = s:" select 20, 21, 22 union"
  s = s:" select 30, 31, 32 union"
  s = s:" select 40, 41, 42 union"
  s = s:" select 50, 51, 52 "

  oRT = oADO.execute(s)
  a = oRT.GetRows()  ; array of query results

  t = "array is"
  For row = 0 To 4
    t = t : @CRLF : a[row,0] : ", " : a[row,1] : ", " : a[row,2]
  Next row

  AskTextbox('','',t,2,0)

Answer:

WinBatch arrays, like many other programming languages, are row major. VB arrays are column major.
Article ID:   W18039
Filename:   GetRows Array Results Explained.txt
File Created: 2010:09:23:09:25:56
Last Updated: 2010:09:23:09:25:56