Sign in to follow this  
Followers 0
Jfish

ADO Excel read/write with open connection and excel obj?

3 posts in this topic

All: I am a COM newbie and don't have a detailed knowledge of ADO. However, I was recently able to create a connection to an Excel spreadsheet and perform queries. I was blown away by the power of this. Then I wanted to write records using the CopyFromRecordset method as in: $oSheet.Cells(1,1).CopyFromRecordset($objRecordSet).

The problem is that I think I have to either: (i) write the recordset to another object or (ii) close my connection before opening the Excel object that was the ADO datasource (which purges the recordset on close). I am wondering:

1.) if my understanding of this is correct, and

2.) if so, are there are any workarounds that folks use to write the data back with this method? I have tried the SQL to insert the records but I have a column that contains a string called "TRUE" and the ADO converts this to -1 for some reason with a global insert command ... but it is "TRUE" when the copyrecord set is used to write to a separate spreadsheet.

3.) If my assumptions are not correct, what am I missing?

Any help would be greatly appreciated.


Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

Share this post


Link to post
Share on other sites



Hi.

Solved this problem?

Share this post


Link to post
Share on other sites

The wiki has an ADO tutorial now which might help you.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0