Solved

ADO Recordset error when appending fields

Posted on 2010-09-08
1
1,907 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

679 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