David Crowell :: Occasional Thoughts

Some Dumb Tech Guy

  Home :: Contact :: Syndication  :: Login
  27 Posts :: 0 Articles :: 53 Comments

Archives

Post Categories

About Me

Archived Software

I had read about the |DataDirectory| macro for connection strings in the context of Sql Server Express Edition.  Imagine my surprise when I found out it works not only on the SqlClient managed provider, but the OleDb managed provider also.

This greatly simplified the configuration of a new website I'm working on that uses an Access database. I know, I don't like Access on the web either, but it wasn't my decision, and it will generally have no more than one user at a time.

Anyway, if you need to use an Access database in the App_Data folder on an ASP.NET 2.0 project, the following connection string will get you started:
Provider=Microsoft.Jet.OLEDB.4.0;Data source=|DataDirectory|TheDatabase.mdb

posted on Wednesday, May 16, 2007 2:37 PM