Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Has anyone accessed SQL 7 data using ADO connections?
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00395150
Message ID:
00395161
Views:
11
>Hello all,
>
>I'm trying to access a SQL 7 table using an ADO connection and so far I have the data in an oddly structured array* (it came from a record set created as an object within VFP 6).
>
>I've used the following structure to connect to the SQL:
>
>oConn = CREATEOBJECT("ADODB.Connection")
>oConn.Open("Connection string")
>
>ors=createobject("adodb.recordset")
>ors.activeconnection=oconn
>
>ors.open("select * from company")
>
>aRecords = ors.getrows() &&This populates the array with all the records in the record set
>
>*The odd array that creates is that it brings all the items in the first field first, then all the items in the second field and so forth. In VFP, normally items stored in an array are brought on a record by record basis.
>
>
>It sounds weird, but this is what's happening right now. Do you have any idea on how to bring records from a SQL table without using a dbc?
>
>Thanks!

If anyone is interested I was able to get it to work:

oConn = CREATEOBJECT("ADODB.Connection")
oConn.Open("Connection string")

ors=createobject("adodb.recordset")
ors.activeconnection=oConn

ors.open("select * from company")
lnRecords = ors.recordcount
Do while not ors.eof
?alltrim(str(ors.Fields("company_id").value)) + ' ' + ors.Fields("name").value + ' ' + ors.Fields("website_url").value
ors.movenext
Enddo

Release ors
Release oConn
For every bug fixed, there is a bigger bug not yet discovered.
Previous
Reply
Map
View

Click here to load this message in the networking platform