Solved

ADO Recordset error when appending fields

Posted on 2010-09-08
1
1,869 Views
Last Modified: 2012-05-10
After googling and searching EE for a solution, I finally admit that I need help from you guys (and girls).

I need to append fields to a closed Recordset. It should be easy enough:

            ADODB.Recordset rs = new ADODB.Recordset();
            rs.Fields.Append("My columne name", ADODB.DataTypeEnum.adDouble, 0, ADODB.FieldAttributeEnum.adFldIsNullable, null);

But then I get this error in the second line:
  Message=Error: Missing method 'instance void [MyClass] ADODB.Fields::Append(string,valuetype ADODB.DataTypeEnum,int32,valuetype ADODB.FieldAttributeEnum,object)' from class 'ADODB.InternalFields'.

I have checked the specifications of the Append-method, and itseems that I am using it correctly.
Still, I hope some of you might tell me what's wrong, so that I can correct my code ASAP :)

Looking forward to your replies.
0
Comment
Question by:royend
1 Comment
 
LVL 5

Accepted Solution

by:
royend earned 0 total points
ID: 33633515
Found the solution:
I had tried the 2.8 and 6.0-version of the ADODB reference, while I had to use:
Microsoft ActiveX Data Objects 2.7 Library

My intention was to make my code more efficient by avoiding an extra for(i = 0; i < n; i++), as I had needed two loops in my original setup:
1. read data into DataList.
2. output into Excel.

I had thought that this would be quicker:
1. read data into Recordset.
2. Use newWorksheet.Range["A2"].CopyFromRecordset(Recordset);

But it turned out to be twice as slow...
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now