Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


How to return a value from an ADO array

Keywords:   old ado arrays

Question:

I have a VBScript that I'm trying to convert to winbatch. The query returns an array of data not just a single value.

In winbatch I try:

oDept = RS.Fields("Department")
deptName=oDept.name
Dept=oDept.value
It returns the field name Department (not the department name) and then errors on the .value statement with Error: 1249: Ole Object: Could not process value returned from object

Snippet of VBscript example below: item in bold is what I'm trying to convert to winbatch, Thanks in advance

Do While Not adoRs.EOF 
For Each adoField in adoRs.Fields
varValue = adoField.Value
varName = adoField.Name
If varName = "ADsPath" Then
WScript.Echo GetDNFromADsPath varvalue)
Else
If Not IsNull(varValue) Then
If IsArray(varValue) Then
For Each varElem in varValue
WScript.Echo varName & String(30 - Len(varName),".") & varElem
Next
Else
WScript.Echo varName & String(30 - Len(varName), ".") & varValue
End If
Else
WScript.Echo varName & vbTab
End If
End If
Next
WScript.Echo
adoRs.MoveNext
lngCount = lngCount + 1
Loop

Answer:

If the data type is adArray it should return 8192 OR'd with the data type in the Array ( i.e. adVarChar ). If that is true, I'm not so sure WB 2002 can handle VB safe arrays; for that matter I'm not so sure ADO does that well with them either.
Article ID:   W15227