Reading Microsoft Access Database 64bit - c#

I have a situation where I'm moving my .NET application to 64bit and I still need to read data from an Microsoft Access database from within C# code. I've had a suggestion where I could write a web service that reads the data periodically from the Microsoft Access and dumps it into SQL Server, so I could then read from SQL table in my application rather than accessing the Microsoft Access database directly.
This has issues like reading from the Microsoft Access database on a specific PC from the web service or WCF service. But I guess an account with relevant permissions would resolve this.
Has anyone else had a situation like this? If so, how have you worked around it?
Thanks in advance for any guidance.

An option might be to link the Access DB to the SQL Server. See Linking Servers on MSDN.

Can you use the ACE OleDb provider to connect your .Net application to Access?
It's a free download, available in both 32 and 64 bit versions. Microsoft Access Database Engine 2010 Redistributable

Note that if you also need to read xlsx in 32-bit application in 64-bit windows, Install MADE 2007 instead of MADE 2010(x86), because same version of MADE 2010(x86 + x64) cannot coexist.

Related

Where to store an Access DB in a VB.Net App?

I am beginner of c# in vb.net. My question is where should I keep access databse to making database application. Because when I distribute it what I need to make global connection string that available client pc. client install in any drive so what I should do to complete the vb.net database application. please advice me step by step because I am beginner
Thanks in Advance
Manish
First thing first,
If your client has not installed Access, you will either have to force him to install or distribute your system installer with embedded Microsoft Access Database Engine Redistributable which you can find on this link.
Microsoft Access Database Engine Redistributable usually provides you everything that you need for Access database usage for .NET
You can always put your file in application directory. As GeirGrusom mentioned, it is not a good practice though. You can get the file path as shown in this link.

Connect to Access database that links to SharePoint lists using C#

I have an window application in which I am trying to connect to a Access Database that has a table linking to a SharePoint list using OLEDB in C#
My attempts:
Use Access 2007 format for the database and Microsoft.ACE.OLEDB.12.0 for the ConnectionString
Everything works perfectly okay, until there's one guy reports the error "The 'Microsolf.ACE.OLEDB.12.0' provider is not registered on the local machine"
Check: he has Windows x86, Access 2003, but not 2007, and does not have "2007 Office System Driver: Data Connectivity Components" installed
Really troublesome and time-consuming to get these installed (Company's machine)
Use Access 2003 format for the database and Microsoft.ACE.OLEDB.12.0 for the ConnectionString
Same error as the above. So I guess it is the "Microsoft.ACE.OLEDB.12.0" that causes the problem. But I don't know how to get it fixed.
Using Access 2003 format for the database and Microsoft.Jet.OLEDB.4.0 for the ConnectionString
Error on my machine: "Could not find installable ISAM" (I don't have Access 2003, but only Access 2007)
His machine: works perfectly
Please help me point out what I can do to fix this problem without having every one update their Office version to 2007 or having the application check people's Office version before connecting to the Access database.
Thanks in advance.
You as a general rule cannot link to something else that is linking to the data!
If the data sitting on SharePoint why attempt to use Access here? You could never link to an Access database that has linked tables to SQL server, so this makes even LESS sense to hit SharePoint this way.
And worse I don't believe that SharePoint supports oleDB linked tables. While Access does support oldDB, and you trying to connect o Access you want to keep in mind that ADO been rather depreciated. While the Access data engine continues to receive all kinds of new features like complex data support (multi-value SharePoint columns), and things like a new-off line disconnected mode we have for Access 2010 with SharePoint, these features are certainly not appropoate to consume by attempting to link to linked tables. As noted, because Access is linked to SQL server or SharePoint in the past, no one would suggest you now attempt to link to the Access file which then in turn must make web service calls to SharePoint (BTW, Access makes web services calls to SharePoint to consume that data).
Since the data is on SharePoint, why are you attempting to hit some file based "thing" sitting on a local hard drive? Why don't you just hit the SharePoint site as a web service? There are tons of web services and ways to consume SharePoint lists in .net. I see little reason and advantage to dump all that fantastic technology and ability in .net to consume web services and then attempting to read some file based Access database that has links to SharePoint. The only way such a setup makes sense is if your development is primary in Access, and that then DOES make sense to dump the use of c# here and just use Access.
My suggestion is thus to consume the SharePoint lists in c#, and by-pass the Access data engine here.

Migrate from SQL Server 2008 to MS access 2007

I would want to migrate the data from SQL Server 2008 to MS access 2007. How can this be done?
Also, how to connect MS access to ASP.NET web application? The code behind the pages is in C#. The IDE is VS 2008. Any pointers appreciated.
Thanks in advance.
My advice. Don't migrate... use SQL Server Express 2008 (free) if you're worried about licensing. MS Access only supports 1 concurrent user at a time. You won't be able to modify your data while the application is using it.
EDIT:
Let me clarify the "only supports 1 concurrent user at a time":
When using access within an ASP.NET application, IIS will lock it and your users will not be able to make edits to the data it is using.
Accessing accdb from ASP.NET is not officially supported. You shouldn't do it.
http://www.microsoft.com/DOWNLOADS/en/details.aspx?FamilyID=c06b8369-60dd-4b64-a44b-84b371ede16d&displaylang=en
The Office System Drivers are only supported under certain scenarios, including:
Desktop applications which read from and write to various files formats including Microsoft Office Access, Microsoft Office Excel and text files.
To transfer data between supported file formats and a database repository such as SQL Server; in the context of a desktop application.
For alternatives to SQL Server with ASP.NET look at SQL Server Express or the myriad of other available options like SQLite, MySQL, Postgres.
Just use the "Import" feature in access, connect to your SQL Server, and import all the data. There are potential incompatibilities but chances are good that you won't run into them.
You'll notice that most database jocks have little regard for access but it's not as dysfunctional as some of them seem to think, when you use it for appropriate purposes.
Is MS Access (JET) suitable for multiuser access?

using MySQL with C#

I want to know if it is possible to use MySQL Engine without having to install WAMP Server. I'm developing an application that will require a database, so I was thinking of using MySQL instead of MS SQL or access. So I don't want to install the WAMP package yet I want to install the MySQL Engine, so if possible, please provide me with the download link for the MySQL and how to install and use (start/stop service).
You will need the runtime and the .net connector to make this happen. You also might find the workbench (gui tools to manage the server and run queries) to be helpful.
The runtime installs a service by default, which you can control on the commandline or via the windows service management console (services.msc).
This sounds to me a lot like you're thinking 'desktop application', where the MySQL database will be a simple local data store. If that's the case, MySQL is not a good choice.
MySQL is a server-class database engine. It's designed to run full time in the background as a service. This makes it overkill for a simple desktop app, and as a user I'd be mad if your simple desktop app required me to run the MySQL service.
For the kind of app I think you're building, you really want an in-process or desktop-class database. Good examples include SQLite, SQL Server Compact Edition (not Express), or even MS Access. Any of those would be a better option here than MySQL.
On the other hand, if I'm wrong and you're building a web app or an app that will be distributed to several computers that all share the same database, then MySQL is a perfectly fine choice and you should read #Femaref's answer.
If your database isn't going to be incredibly large you could go with SQL Compact. It comes with the .NET framework, and works well for smaller databases.

Microsoft Access required for C# database access on end-user machines?

Silly question, perhaps.
I've developed an app on my machine that uses a Microsoft Access database (.mdb) to access certain information and populate a table with monitoring data using OLEDb.
The application works fine on my machine, but when I put the release on test machines (without MS Access), it crashes. Interestingly, if I were to launch the application on the testing machine with the database filename just renamed, it loads like it should albeit without the data.
I seem to get an UnauthorizedAccessException exception thrown which further clouds my confusion.
Both the development machine and the machine I'm testing it on have .NET 3.5 installed.
I would expect a barage of 'No's in reply to my question, but what the heck - does the testing machine need to have MS Access installed?
Regards
Try downloading the Office Connectivity Components here. This will let you read and create Access databases without having Access installed.
It doesn't need MS Access but you will need the required driver for your version of Access. You may need to do a test release that outputs to a log the exact Exception and message.
Make sure you have latest Jet 4 OLEDB drivers installed. There might also be a problem if you run the application from a network share (then it runs with restricted rights).
You say you got an UnauthorizedAccessException. I'd check read/write permissions to the .mdb file and location first.
If you're running as a service remember that they run under more restricted accounts.
You don't need Access itself. You will need to have JET drivers and associated files at least as current as the ones on your development machine — if you're recycling an old machine to use for testing that could be the problem.
However, this really sounds like a permissions issue, either on the database file itself or inside the file if you're using Access's security mechanisms.
It turns out the issue was a hardware problem. One of the serial ports on the card I was using had gone capput when it got moved to a new machine.
Turns out the problem wasn't database related, as the exception would've suggested.
Some interesting points on JET were raised though, which could be useful to anyone with Database access issues.
Thanks for your help guys.

Categories