We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,707 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Active X with C# error "ActiveX cannot create an object"

Hi there,

I am using third party ActiveX control in my application. It requires RecordSet as a input parameter to its method. I am programming my application in C#. When I call the method after creating RecordSet it throws an exception "ActiveX cannot create an object". What is the potential cause?

My code is as bellow:

// third party ActiveX object.
 DCSOCS.OCScallClass ocsCall = new DCSOCS.OCScallClass();

 ADODB.Recordset recordSet = new ADODB.RecordsetClass();
          string result = "";
        

            recordSet.Fields._Append("MIMSHOST", DataTypeEnum.adVarChar, 50, FieldAttributeEnum.adFldFixed);
            recordSet.Fields._Append("MIMSPORT", DataTypeEnum.adVarChar, 50, FieldAttributeEnum.adFldFixed);
            recordSet.Fields._Append("MIMSUSER", DataTypeEnum.adVarChar, 50, FieldAttributeEnum.adFldFixed);
            recordSet.Fields._Append("MIMSPASSWORD", DataTypeEnum.adVarChar, 50, FieldAttributeEnum.adFldFixed);
            recordSet.Fields._Append("MIMSDISTRICT", DataTypeEnum.adVarChar, 50, FieldAttributeEnum.adFldFixed);
            recordSet.Fields._Append("MIMSPOSITION", DataTypeEnum.adVarChar, 50, FieldAttributeEnum.adFldFixed);
            recordSet.Fields._Append("WorkGroup", DataTypeEnum.adVarChar, 50, FieldAttributeEnum.adFldFixed);
            recordSet.Fields._Append("EmployeeID", DataTypeEnum.adVarChar, 50, FieldAttributeEnum.adFldFixed);
            recordSet.Fields._Append("NewActivityID", DataTypeEnum.adVarChar, 50, FieldAttributeEnum.adFldFixed);
            recordSet.Fields._Append("FromActivityDate", DataTypeEnum.adVarChar, 50, FieldAttributeEnum.adFldFixed);
            recordSet.Fields._Append("ToActivityDate", DataTypeEnum.adVarChar, 50, FieldAttributeEnum.adFldFixed);
            recordSet.Fields._Append("ChangeActInd", DataTypeEnum.adVarChar, 50, FieldAttributeEnum.adFldFixed);
           
            recordSet.Open(System.Reflection.Missing.Value, System.Reflection.Missing.Value, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockOptimistic, -1);

            recordSet.AddNew(System.Reflection.Missing.Value, System.Reflection.Missing.Value);

            recordSet.Fields[0].Value = server;
            recordSet.Fields[1].Value = port;
            recordSet.Fields[2].Value = user;
            recordSet.Fields[3].Value = password;
            recordSet.Fields[4].Value = district;
            recordSet.Fields[5].Value = null;
            recordSet.Fields[6].Value =employee.Workgroup;
            recordSet.Fields[7].Value = leave.EmployeeID;
            
            recordSet.Fields[8].Value = reason.Code;
            recordSet.Fields[9].Value = leave.Start.ToString(Constants.EllipseDate);
            recordSet.Fields[10].Value = leave.End.ToString(Constants.EllipseDate);
            recordSet.Fields[11].Value = "A";
            

            try
            {
               
                result = ocsCall.UpdateRoster(ref recordSet);
                //recordSet.Close();

            }
            catch (Exception ex)
            {
                DCS.OCS.Common.Error.Log("Ellipse", ex.ToString());
                //recordSet.Close();
                return "Ellipse Error";
            }
            return result;
2
Contributors
3
Replies
12 Hours
Discussion Span
4 Years Ago
Last Updated
4
Views
virang_21
Light Poster
29 posts since Jan 2009
Reputation Points: 10
Solved Threads: 2
Skill Endorsements: 0

Check 3rd party control documentation!

Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
Skill Endorsements: 7

There is minimul documentation from 3rd party and that just suggest use adVarchar as input parameters of fields with width of 50. and takes in RecordSet as referenced input parameter.

Is there a way to debug DLL ? To at least know what is causing problem inside 3rd party DLL. I tried looking at Exception and try to access root cause but nothing coming out of it.

virang_21
Light Poster
29 posts since Jan 2009
Reputation Points: 10
Solved Threads: 2
Skill Endorsements: 0

Can you send me the documentation, or try to register the ocx again.

Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
Skill Endorsements: 7

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0705 seconds using 2.73MB