Icemanind
Icemanind

Reputation: 48686

ADO.NET database access

I have written a program in VB.NET and one of the things this program does is insert records into a Microsoft Access database. The backend of my program that access the database is written as an interchangeable layer. If I "swap" this layer out with a layer that used a Microsoft SQL Server database, my program flies. If I use MS Access, its still pretty quick, but it is much slower. Does anyone have any hints or tips on how to speed up ADO.NET transactions using Microsoft Access? I would really rather use MS Access over SQL Server so that I can distribute my database with my program (rather then connecting to some remote SQL Server). Any suggestions? Also, when I created the MS Access database, I created it in Access 2000 compatible mode. would it be faster to use 2003 compatible mode?

Thanks in advance

Upvotes: 0

Views: 1269

Answers (6)

Christian
Christian

Reputation: 4342

The MSDN features an Article on how to speed up ADO.NET: http://msdn.microsoft.com/en-us/library/ms998569.aspx Even though the article is a bit dusty, it still makes a few good points :)

Other than that, using MS Access myself, I found that a few techniques such as caching of data, selecting without the source scheme or optimizing queries are suitable to keep the performance at a halfway decent level.

Upvotes: 0

Doc Brown
Doc Brown

Reputation: 20044

To my experience, ADO.NET is not much optimized for MS Access. Using the older ADO or DAO interfaces (which are available in VB.NET via COM) can bring you performance improvements about a factor 20 or more in some cases. But it all depends a lot of what SQL statements your program really does (lots of batch updates / insert, or lots of queries with large result sets, or lots of interactive LOAD-Transform-Store Cycles).

Upvotes: 0

Jeremy McGee
Jeremy McGee

Reputation: 25200

Although you need to install it, SQL Server Express supports "XCopy file deployment" where all you need to do to deploy the application is ship an .mdf file and your executables.

Details are here on MSDN.

This does support stored procedures: I've used it in our unit tests to dynamically create a mocked-out database on the fly.

Upvotes: 2

Tony Toews
Tony Toews

Reputation: 7882

Did you also have the Access backend open in Access at the same time? If so try your program without having it open. If that speeds things up then you should open either a database connection or a recordset (against a table with few records) and leave it open while processing the data.

The problem is that if you open and close objects or recordsets against an Access database file and someone else is in the Access database file, Jet wastes a lot of time doing locks against the LDB file. So keeping a permaneent connection to the Access database file solves this problem.

Upvotes: 0

cdonner
cdonner

Reputation: 37658

SQL Server Compact 3.5 will give you the same benefit - a single database file that you can deploy and distribute (as long as you include the runtime assemblies in your app). It has reduced query capabilities compared to a full SQL Server instance, but it is definitely faster than the Access engine.

I have used it with a mobile app that has a desktop component and it did everything I needed it to do.

Upvotes: 0

Justin Niessner
Justin Niessner

Reputation: 245399

Access is, as you're experiencing, less than optimal.

Have you taken a look at SQL Server Compact Edition. It can be embedded and distributed with your application...and should perform much better than Access.

Upvotes: 1

Related Questions