You are right. Mine got accidently working after I compiled the project on a 32-bit computer. It was only working after the build. Inside VisualStudio itself I could not connect to the databse. But now I did found the solution.
Installing the "Microsoft Access Database Engine 2010 Redistributable", followed by the "2007 Office System Driver: Data Connectivity Components" solved the problem for me!
When VisualStudio is debugging it wants the 32-bit version of the ACE.OLEDB.12.0 provider, so you need both of them on your computer. When you stop debugging you get back into VisualStudio and the Database will look like disconnected again. Just refresh and he finds the right OLEDB provider. Some said it is not possible, but it does!
It's written on the forum below what steps you have to follow.
I agree with norman - go to SQL Server ( but add a little bit of ADO.NET for completness ).
We have lots of DB-Acad-.XSLx-CSV-and-you-name-it work plus x86 and x64 AutoCADs (even 32bit Acad on 64bit comp.) on different machines plus legacy code (!). If you add to the .NET-SQL tandem a little bit of ADO.NET 4 you are on the right direction.
From ADO.NET we get data from DWGs then we sort and consolidate and then we export to whatever we want ( ADO.NET has data providers for almost everything).
My choice after working for some years with MySQL+ODBC+ACAD is MSSQL+.NET+ADO.NET+OpenXML+ACAD.
Explore this link http://msdn.microsoft.com/en-us/library/ms971485.a
I haven't read all the postings in detail, but I found a way to install 64Bit ACE Engine on systems with 32 Bit Office.
Download AccessDatabaseEngine_x64.exe http://www.microsoft.com/download/en/details.aspx?
And install it via Command Line with:
> AccessDatabaseEngine_x64.exe \passive
Now you should be able to connect to Access DB Files even though it is 32 Bit and your environment is 64 Bit.
Just wanted to let you know that your repsonce here was very helpful to me too. I've been struggling with a suite of Access databases used over the past 10 years and now moving to .net to connect both 32bit and 64bit Acad to them. It's time to update the DB's before i can move forward. Again, appreicate your thoughtfull responce.
Has anyone found a solution and tell me how to do? I have read hundreds of pages but have nothing.
I want to read excel files with the connection string
connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;" & _
"Data Source=" & FileName & ";" & _
"Extended Properties=""Excel 12.0;HDR=YES;IMEX=1;"""
I am using Windows 7 64 bit, Autocad 2012 64 bit, Office 2010 32 bit.
If not an Autocad dll, I can change target cpu to X86 and it works, but for Autocad it has to be X64, and I can't install 64 bit Jet since Office is 32 bit. There is no way i can do this.
AutoCAD 2012 (x64)
Although you said "it is no way I can do this", have you tried to install MS Access Engine 64blt, as suggested by plonga's reply? AFAIK, one can install 64-bit MS Access Engine with MS Office 2010 32-bit in the same computer (it is not possible if you use MS Office 2007). But you may have to uninstall MS Office first, then install the MS Access Engine 64-bit and reinstall MS Office 32-bit. You may read more on this topic by searching the web. Bottom line is, for your code shown here to work, you must install MS Access engine 64-bit, because your AutoCAD is 64-bit. It can be done. But I'd not suggest it is good solution in most cases. Read on.
On the other hand you can easily to have a solution (maybe a better sotion for your specific need) to get around the 64-bit MS Access Engine issue:
- Do you really need to store data in Excel worksheet format? If the *.xlsx file is only for storing data, not the presentation format, while you still prefer to be able to open the data file in Excel, you can consider to save the data as *.csv format, which is comma delimited text data string and can be read/written from/to by code very fast, and can be open in Excel.
- If you want to keep the presention format in Excel, you can consider to use Open Xml, which is designed to access MS Office document (*.docx, *.xlsx) without the need of installing MS Office (Word, Excel), to access data stored in *.xlsx file.
- if the data is shared office-wide/by multiple users, consider to place data in a sutale database system (SQL Server, SQL Server Express...). Just the facotr that you need to install MS Acess Engine 64-bit in every computer that may run your code along may lead you to give it up.
I have been forced to research SQL server lately since I have a database Licensing program I am trying to work with. I am having a hell of a time wrapping my head around how to set up a server for a specific file so it can be accessed from an external program. It happens to be named LicenseService.mdb My program has to add and manipulate data within that file, which happens to be on the internet.
Since it is named as an mdb, does this mean that SQl can not open or manipulate it? Does simply installing MS SQL automatically set up my server, since my licensing program has to make a SQL command. I don't understand how this whole thing works.
When setting up a "server", How do I do that and what would those names be?
I investigated servers but don't know how to set them up for calling connections strings. Not sure I have a 'server'.
Is the configuration manager on the right track or do I not get the picture?
*.MDF file is just data file holding data for particular database hosted by a SQL Server. your application/code never deals with it (except for attaching it to a SQL Server, if the code is for SQL Server database setup).
For your applicatioon (AutoCAD addin, right?) to access data in a database hosted by a SQL Server, you need to have a SQL Server and a database hosted iin the SQL Server reachable in the network (intranet, usually, or the same computer). If the SQL Server is hosted on the Internet, well, technically, it can be allowed to be accessed to directly via the Internet, but no one in his right mind will open the database's door wide to the Internet. To assess data via the Internet, you need to build a web application and/or a web service application, and hide the SQL Server/database behind (e.g. the web application/services will be accessing the database when your user uses the web application/services). It is quite complicated when the Internet is involved.
If your users live inside a corporate network, you can then have your AutoCAD addins dirrectly access the SQL Server/database, although a middle layer of data access would be the best practice.
My feel is, if your solutioon is baed on data hosted in the Internet, you need to find help from someone who knows how to do web applications/services, or you need to learn a lot before doing the solution. Never try to connect SQL Server via the Internet (you'll never get through the connection, unless you host it yourself and make it wide open to the net).
Or, you may start with installing/hosting SQL Server in the LAN or your own computer and learn more. When you are comfortable with data access technology with SQL Server (or any other database server, foe that matter), you can then look into moving the data into the web. I am sure you know SQL Server Express is free. you can install it in your computer and start from there.
Pardon if you already know all this, if so maybe it will help others moving to the deep end of the pool.
SQL Server doesn't use "files" per se, at least not how Access or SQLite uses them. You run SQL Server on a server, which then allows for the creation of databases and contained tables, queries, and other database-related information. When establishing a connection, its similar to conneccting to an Access database (file), except instead of specifying a file you specify a server which is running the SQL Server program.
SQL Server set up and management is a very complex topic, to the point where its practical for people to specialize in nothing *but* that. If you don't have one of those specialists on staff, bringing in a consultant will be worth the cost.
If you are going to fly by the seat of your pants, expect friction burns.
Adopt. Adapt. Overcome. Or be overcome.
I am with you and thanks for your very usefull information. I am new to accessing data, but the applications I have builds a web application (ASP) which I have to password protect beyond a point. Yes the datafile is hidden from direct access, but your feedback tells me I have to look closer at the hosting service to get them to provide a sql server so I can write to the database, I believe is what I am hearing, instead on my local machine.
Thanks very much for the explainattion.