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

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Jan 2009
Posts: 13
Reputation: virang_21 is an unknown quantity at this point 
Solved Threads: 0
virang_21 virang_21 is offline Offline
Newbie Poster

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

 
0
  #1
Jan 14th, 2009
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:

  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;
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

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

 
0
  #2
Jan 14th, 2009
Check 3rd party control documentation!
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 13
Reputation: virang_21 is an unknown quantity at this point 
Solved Threads: 0
virang_21 virang_21 is offline Offline
Newbie Poster

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

 
0
  #3
Jan 14th, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

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

 
0
  #4
Jan 15th, 2009
Can you send me the documentation, or try to register the ocx again.
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C# Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC