Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9081321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T20:17:15+00:00 2026-06-16T20:17:15+00:00

I have created a C# dll to be used in MS Access. All works

  • 0

I have created a C# dll to be used in MS Access. All works well on my dev machine. The C# dll has methods with return type as ADODB.Recordset. I have bound the returned recordset with MS Access forms and it works great on my development machine.

The problem is when I install the dll using an Installer on a different machine and run MS Access application. There is no error, but it always returns a null recordset. I have checked the references in MS Access and it is referencing my custom dll and Microsoft ActiveX Data Objects 2.1 Library and there is no error in calling the C# methods. The other methods which return arrays and string are working fine, only methods with ADODB.Recordset as the return type have this problem.

My Development Machine: Windows Vista Service Pack Service Pack 2
Testing Machine: Windows 7 Professional Edition

The code for converting datatable to ADOD.Recordset in C# dll is as follows,

private Recordset ConvertToRecordset(DataTable inTable)
{
    ADODB.Recordset result = new ADODB.Recordset();
    result.CursorLocation = ADODB.CursorLocationEnum.adUseClient;

    ADODB.Fields resultFields = result.Fields;
    System.Data.DataColumnCollection inColumns = inTable.Columns;

    foreach (DataColumn inColumn in inColumns)
    {
        resultFields.Append(inColumn.ColumnName
              , TranslateType(inColumn.DataType)
              , inColumn.MaxLength
              , inColumn.AllowDBNull ? ADODB.FieldAttributeEnum.adFldIsNullable :
                                         ADODB.FieldAttributeEnum.adFldUnspecified
              , null);
    }

    result.Open(System.Reflection.Missing.Value
              , System.Reflection.Missing.Value
              , ADODB.CursorTypeEnum.adOpenStatic
              , ADODB.LockTypeEnum.adLockOptimistic, 0);

    foreach (DataRow dr in inTable.Rows)
    {
        result.AddNew(System.Reflection.Missing.Value,
                      System.Reflection.Missing.Value);

        for (int columnIndex = 0; columnIndex < inColumns.Count; columnIndex++)
        {
            resultFields[columnIndex].Value = dr[columnIndex];
        }
    }

    return result;
}

private DataTypeEnum TranslateType(Type columnType)
{
    switch (columnType.UnderlyingSystemType.ToString())
    {
        case "System.Boolean":
            return ADODB.DataTypeEnum.adBoolean;

        case "System.Byte":
            return ADODB.DataTypeEnum.adUnsignedTinyInt;

        case "System.Char":
            return ADODB.DataTypeEnum.adChar;

        case "System.DateTime":
            return ADODB.DataTypeEnum.adDate;

        case "System.Decimal":
            return ADODB.DataTypeEnum.adCurrency;

        case "System.Double":
            return ADODB.DataTypeEnum.adDouble;

        case "System.Int16":
            return ADODB.DataTypeEnum.adSmallInt;

        case "System.Int32":
            return ADODB.DataTypeEnum.adInteger;

        case "System.Int64":
            return ADODB.DataTypeEnum.adBigInt;

        case "System.SByte":
            return ADODB.DataTypeEnum.adTinyInt;

        case "System.Single":
            return ADODB.DataTypeEnum.adSingle;

        case "System.UInt16":
            return ADODB.DataTypeEnum.adUnsignedSmallInt;

        case "System.UInt32":
            return ADODB.DataTypeEnum.adUnsignedInt;

        case "System.UInt64":
            return ADODB.DataTypeEnum.adUnsignedBigInt;

        case "System.String":
        default:
            return ADODB.DataTypeEnum.adVarChar;
    }
}

I pass a DataTable to the above mentioned method like this and return the result:

ADODB.Recordset instanceRS = ConvertToRecordset(instancesDT);
return instanceRS;

One more time: the dataset returned on my development machine is fine and all the records are populated, but on testing machine it is always null. I have read somewhere that Microsoft ActiveX Data Objects 2.1 Library for Windows 7 has to do something with it, but I can’t find anything more specific. Is this right? How can I fix this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T20:17:16+00:00Added an answer on June 16, 2026 at 8:17 pm

    Is this an ActiveX control? If so are you sure your install program is registering the activex dll?

    You need to register the activex dll on the local machine.

    (For example a google search shows this)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just created a .dll file that has some methods. And I have a another
I have created several DLL (.NET) libraries that are used in several projects. In
I have created a C# dll and registerd as Com object. (Used ProgID, Set
I have created a C# DLL to be used from Excel VBA. I compiled
I have to create a DLL which is used by a VB6 application. This
I have created an ActiveX dll using VB6 and packaged it using the Package
I am using IIS 6 on 2003. I have created a HTTP handler dll
We have a library created as both .lib and .dll (it's a big library
I have a .Net DLL that I created that implements a WCF client that
I have a .NET assembly DLL that is created on-the-fly from pre-compiled code in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.