943,553 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Unsolved
  • Views: 1129
  • C# RSS
Jan 14th, 2009
0

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

Expand Post »
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:

C# Syntax (Toggle Plain Text)
  1. // third party ActiveX object.
  2. DCSOCS.OCScallClass ocsCall = new DCSOCS.OCScallClass();
  3.  
  4. ADODB.Recordset recordSet = new ADODB.RecordsetClass();
  5. string result = "";
  6.  
  7.  
  8. recordSet.Fields._Append("MIMSHOST", DataTypeEnum.adVarChar, 50, FieldAttributeEnum.adFldFixed);
  9. recordSet.Fields._Append("MIMSPORT", DataTypeEnum.adVarChar, 50, FieldAttributeEnum.adFldFixed);
  10. recordSet.Fields._Append("MIMSUSER", DataTypeEnum.adVarChar, 50, FieldAttributeEnum.adFldFixed);
  11. recordSet.Fields._Append("MIMSPASSWORD", DataTypeEnum.adVarChar, 50, FieldAttributeEnum.adFldFixed);
  12. recordSet.Fields._Append("MIMSDISTRICT", DataTypeEnum.adVarChar, 50, FieldAttributeEnum.adFldFixed);
  13. recordSet.Fields._Append("MIMSPOSITION", DataTypeEnum.adVarChar, 50, FieldAttributeEnum.adFldFixed);
  14. recordSet.Fields._Append("WorkGroup", DataTypeEnum.adVarChar, 50, FieldAttributeEnum.adFldFixed);
  15. recordSet.Fields._Append("EmployeeID", DataTypeEnum.adVarChar, 50, FieldAttributeEnum.adFldFixed);
  16. recordSet.Fields._Append("NewActivityID", DataTypeEnum.adVarChar, 50, FieldAttributeEnum.adFldFixed);
  17. recordSet.Fields._Append("FromActivityDate", DataTypeEnum.adVarChar, 50, FieldAttributeEnum.adFldFixed);
  18. recordSet.Fields._Append("ToActivityDate", DataTypeEnum.adVarChar, 50, FieldAttributeEnum.adFldFixed);
  19. recordSet.Fields._Append("ChangeActInd", DataTypeEnum.adVarChar, 50, FieldAttributeEnum.adFldFixed);
  20.  
  21. recordSet.Open(System.Reflection.Missing.Value, System.Reflection.Missing.Value, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockOptimistic, -1);
  22.  
  23. recordSet.AddNew(System.Reflection.Missing.Value, System.Reflection.Missing.Value);
  24.  
  25. recordSet.Fields[0].Value = server;
  26. recordSet.Fields[1].Value = port;
  27. recordSet.Fields[2].Value = user;
  28. recordSet.Fields[3].Value = password;
  29. recordSet.Fields[4].Value = district;
  30. recordSet.Fields[5].Value = null;
  31. recordSet.Fields[6].Value =employee.Workgroup;
  32. recordSet.Fields[7].Value = leave.EmployeeID;
  33.  
  34. recordSet.Fields[8].Value = reason.Code;
  35. recordSet.Fields[9].Value = leave.Start.ToString(Constants.EllipseDate);
  36. recordSet.Fields[10].Value = leave.End.ToString(Constants.EllipseDate);
  37. recordSet.Fields[11].Value = "A";
  38.  
  39.  
  40. try
  41. {
  42.  
  43. result = ocsCall.UpdateRoster(ref recordSet);
  44. //recordSet.Close();
  45.  
  46. }
  47. catch (Exception ex)
  48. {
  49. DCS.OCS.Common.Error.Log("Ellipse", ex.ToString());
  50. //recordSet.Close();
  51. return "Ellipse Error";
  52. }
  53. return result;
Similar Threads
Reputation Points: 10
Solved Threads: 2
Light Poster
virang_21 is offline Offline
29 posts
since Jan 2009
Jan 14th, 2009
0

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

Check 3rd party control documentation!
Featured Poster
Reputation Points: 480
Solved Threads: 276
Postaholic
Ramy Mahrous is offline Offline
2,189 posts
since Aug 2006
Jan 14th, 2009
0

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

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.
Reputation Points: 10
Solved Threads: 2
Light Poster
virang_21 is offline Offline
29 posts
since Jan 2009
Jan 15th, 2009
0

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

Can you send me the documentation, or try to register the ocx again.
Featured Poster
Reputation Points: 480
Solved Threads: 276
Postaholic
Ramy Mahrous is offline Offline
2,189 posts
since Aug 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: display a charactar in x,y coordinate
Next Thread in C# Forum Timeline: checkboxes in datagridview(windows application)





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC