The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
ADODB.Fields
Posted: 01 May 08 1:22 PM
|
Does any one know why SLX cant create ADODB.Fields using the create object method or maybe I am missing a component.
Or better yet does anyone know a quick way to loop through column names on a recordset
thanks
|
|
|
|
Re: ADODB.Fields
Posted: 01 May 08 2:29 PM
|
DIM I, theValue WHILE NOT (rs.EOF) For I = 0 to rs.Fields.Count - 1
TheValue = rs.FIELDS(i).VALUE NEXT rs.MOVENEXT WEND
|
|
|
|
Re: ADODB.Fields
Posted: 01 May 08 3:18 PM
|
this code will bet the the values of the column, i am interested on the ColumnName i.e.
select firstname, lastname, company from sometable
I was trying to do thid
Dim Fld, ColumnName set fld = createobject("ADODB.Field") for each fld in rs.fields ColumnName = fld.Name Next
but for some reason SLX cant create an ADODB.field |
|
|
|
Re: ADODB.Fields
Posted: 01 May 08 4:27 PM
|
You *don't* need to use CreateObject to create a ADODB.Field if you're already going to be getting the reference assigned elsewhere. In your code your fld variable will reference the field as set by the enumerator for the loop. All you need is to just do this:
Dim fld For Each fld in rs.Fields MsgBox fld.Name Next
Get the idea? |
|
|
|
Re: ADODB.Fields
Posted: 01 May 08 6:08 PM
|
Thx...I found an article about that as well, I got my loop working using the actual recordset object looping through the field collection since I was comparing column names with an array
For i=0 To rsExcel.Fields.Count -1 msgbox rsExcel.Fields(i).Name Next |
|
|
|