Author Topic: ADODB Error in AutoCAD  (Read 2786 times)

0 Members and 1 Guest are viewing this topic.

sivag75

  • Guest
ADODB Error in AutoCAD
« on: March 18, 2015, 11:50:32 PM »
Hi,

I'm developing a program for AutoCAD 2010, which needs to interact with the MS-Access database.

The system details are:
ACAD 2010
VB.Net
Windows XP
Vis. Studio 2008

In the solution I've referenced "Interop.ADODB.dll v2.8" assembly and using adodb connection to access the database. The program works fine in the XP systems.

But, when I run the program in Windows 7 systems, it throws an error (refer the screenshot) when trying to connect the database.

But, I'm using the same method in the normal windows exe. It is working fine. But in AutoCAD, it gives the error.

Should I need to compile separate dlls on XP and WIN7 systems or is there any other solution ?

Note: I also did reverse approach. Compiled the program in WIN7 system and tested it in the XP system. In this case, it did not show that error.

Please suggest a solution.

Thanks
Regards,
gsktry
« Last Edit: March 18, 2015, 11:57:55 PM by sivag75 »

Andrey Bushman

  • Swamp Rat
  • Posts: 864
Re: ADODB Error in AutoCAD
« Reply #1 on: March 19, 2015, 12:42:45 AM »
I am assuming your WinXP is x86, but Win7 is 64. I am assuming also - your output result (for Win7) is not x64 (for both cases: your exe or .net-extension for AutoCAD), or your references of COM wrappers is x86 still.

At this case when you build x86 it works on Win7 x64 as Wow64-application. Your AutoCAD on Win7 x64 is x64 too. Your x86 .net-extension can not to be loaded into x64 process as x86 or Wow64.

ADODB - is bad way. ADO.Net is better.
« Last Edit: March 19, 2015, 12:52:34 AM by Andrey Bushman »

sivag75

  • Guest
Re: ADODB Error in AutoCAD
« Reply #2 on: March 19, 2015, 02:44:07 AM »
Sorry. I'm bit unclear on this.

Moving to ADO.Net is not possible for me now as it involves many code changes in the existing application.

My XP is X86 and WIN7 is 64. I set the target CPU as ' ANY CPU ' for the autocad dll.

Do you mean to say that the adodb interop assembly compiled in x86 system won't work in x64 system ?
In this case, If I compile separate versions on each x86 and x64, will it solve the problem ?

Thanks
gsktry

Andrey Bushman

  • Swamp Rat
  • Posts: 864
Re: ADODB Error in AutoCAD
« Reply #3 on: March 19, 2015, 02:49:56 AM »
Do you mean to say that the adodb interop assembly compiled in x86 system won't work in x64 system ?
In this case, If I compile separate versions on each x86 and x64, will it solve the problem ?
You asked similar question (about Interop) here. I answered to your question on that topic already. What doesn't allow for you to try to do it? :)

sivag75

  • Guest
Re: ADODB Error in AutoCAD
« Reply #4 on: March 19, 2015, 03:07:04 AM »
Yes. there I removed the interop assemblies and changed the coding to late-binding.
Is it possible to do the same thing for the adodb interop connection also ? If yes, I google again for applying late-binding in the adodb connection.

Andrey Bushman

  • Swamp Rat
  • Posts: 864
Re: ADODB Error in AutoCAD
« Reply #5 on: March 19, 2015, 03:11:50 AM »
You can use the late binding instead Interop alwais - in any your applications. But if your code sources has many Interop-code, maybe it will be more convinient way - compile it twice: for x64 and for x86. Usually, I solve similar problems through the Entry Point.
« Last Edit: March 19, 2015, 03:28:06 AM by Andrey Bushman »

n.yuan

  • Bull Frog
  • Posts: 348
Re: ADODB Error in AutoCAD
« Reply #6 on: March 19, 2015, 09:32:39 AM »
Sorry. I'm bit unclear on this.

Moving to ADO.Net is not possible for me now as it involves many code changes in the existing application.

My XP is X86 and WIN7 is 64. I set the target CPU as ' ANY CPU ' for the autocad dll.

Do you mean to say that the adodb interop assembly compiled in x86 system won't work in x64 system ?
In this case, If I compile separate versions on each x86 and x64, will it solve the problem ?

Thanks
gsktry

Since the DB is an MS Access database, it is very likely the problem is the computer does not have 64-bit MS Access database engine installed. What is the ConnectionString you use to create ADODB.Connection?

The reason it works in Win EXE is the EXE actually runs as 32-bit process, while in your 64-bit AutoCAD, the code must 64-bit component (the MS Access Engine, which is the replacement of MS Jet Engine used for MS Access 2003 or earlier.

You need to download MS Access Engine 64-bit and install it, which is a bit tricky or difficult if the computer has older MS Office installed (MS Office 2010 or earlier). This alone might make using MS Access as data source as very bad choice and not worth the effort.

Even you have to stick with a lot existing ADODB code, replacing the Access DB with, say, SQL Express would only result in minimum code change, if the ADODB code is fairly well written.

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: ADODB Error in AutoCAD
« Reply #7 on: March 19, 2015, 10:20:33 AM »
SQL *sounds* like a good replacement, and it is from the programming side.  From the management side that's another story.  You need to manage the creation, archiving, and destruction of databases which is more difficult than the simple file management involved with Access file-based databases.

And, it gets IT involved.  That adds another layer of administrative complexity.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

sivag75

  • Guest
Re: ADODB Error in AutoCAD
« Reply #8 on: March 19, 2015, 11:41:01 PM »
Hi n.yuan,

The client system is installed with full version of MS-Offce-64 bit.

The problem is with the AutoCAD. If the AutoCAD program got compiled in 32 bit environment, it shows adodb error in the AutoCAD in WIN7 environment. But, if the program got compiled in 64 bit environment, then there is no connectivity issue.

As dgorsman said, management will not accept moving to SQL now. It might take few more years. :-(

Now, I have decided to give separate versions of 32 bit and 64 bit.

Thanks
gsktry

MexicanCustard

  • Swamp Rat
  • Posts: 705
Re: ADODB Error in AutoCAD
« Reply #9 on: March 23, 2015, 08:02:45 AM »
If you want SQL but don't want or cant build the SQL infrastructure.  There is always SQL Compact.  It's a great replacement for MS Access. Then when your office is ready for an SQL server its a simple connection string change.  Then you can use Entity Framework and stop using dinosaurs like ADODB and ADO.NET.
Revit 2019, AMEP 2019 64bit Win 10