Thursday, April 28, 2011

Error: QueryInterface for interface MyCOM._MyClassFile failed.

Error: QueryInterface for interface MyCOM._MyClassFile failed.
   at MyCOM.MyClassFile.Connect(String& Param1, String& Param2)
   at Company.TestApplication..ctor(Int32 ApplicationId, String p_UserAgencyID, String p_UserView, String p_sMode) in C:\Code\Development\MyWorkNet\TestApplication.vb:line 4884
   at MyApp.MyAppFile.MyMethod1(OracleConnection oConn, OracleTransaction trans, DataRow Record) in C:\Code\Development\MyAppFile.vb:line 349
   at MyApp.MyAppFile.MyMethod2(DataRow Record) in C:\Code\Development\MyApp\MyAppFile.vb:line 308



Cause of error:
This is not the real error.  This is just a abstraction of real error.
You would generally see this error when .exe file is throwing error.


Solution:
This error may occur for multiple reason so you start with

1) Check all necessary software's are installed on PC where you are trying to execute the process which is throwing this error.
Example: If your process needs .Net 4.0 Framework needs to install, then it should be installed.

2) Copy of .exe files and .dll to server and trying to execute process, may result into error.
Example: If you tried to reference COM .dll's in your development solution and build the project.  Then try to do Copy of .exe file and .dll file to another server, that can result into this error, because .dll's are still referencing the path of your development server in most of the case.  If possible try to create a Setup file and make the deployment, this can avoid that error, if that could be the reason.

3) Debug the code by connecting to same database which your process is using.
You will get this error when one of Query is not executing correctly, while code is running.

This error can either occur if stored proc is not proper or trigger is not running properly, or may be data issue, example integrity constraint (MYDBName.FK_Myfield_MyTable) violated - parent key not found

The best way to fix this error is debug the code by connecting to same database (If possible).  You need to come to point where it is throwing error and you would find the exact issue.

Its general tendency to first blame that code is not good, but in this case it has something to do with database rather than code.  I am not sure whether this has helped much, but i am sure this would put you in right direction to explore fix.

Most Recent Post

Subscribe Blog via Email

Enter your email address:



Disclaimers:We have tried hard to provide accurate information, as a user, you agree that you bear sole responsibility for your own decisions to use any programs, documents, source code, tips, articles or any other information provided on this Blog.
Page copy protected against web site content infringement by Copyscape