qanuj / elmah

Automatically exported from code.google.com/p/elmah
0 stars 0 forks source link

Add a programmatic way to create/setup the Access MDB file #60

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Currently, someone has to make a copy of a pre-supplied and empty Access 
MDB to use the AccessErrorLog implementation. We should investigate if 
there is a way to create the database and table through a programmatic 
interface. This would allow the MDB to be created dynamically at runtime 
if it does not exist (as the SQLiteErrorLog does), making it even simpler 
to start using the solution and only require the ELMAH DLL to be moved 
around. Perhaps the best way is to start with this is a WSH script to try 
and create the database via ADOX. If that works, then investigate how it 
could also be done via managed code using COM interop.

This issue was created from the following comment to issue #59:
http://code.google.com/p/elmah/issues/detail?id=59#c1

Original issue reported on code.google.com by azizatif on 8 May 2008 at 6:03

GoogleCodeExporter commented 9 years ago
For reference, the following MS KB article shows how to create MS Access 
database 
using ADOX and C#:

http://support.microsoft.com/kb/317881/en-us

The following MS KB article is a little more comprehensive and shows how to 
also 
create a table with a primary key:

http://support.microsoft.com/kb/252908/en-us

It is written in "classic" Visual Basic but should be easily portable to either 
VBScript or to Visual Basic or C# using COM interop.

Original comment by azizatif on 8 May 2008 at 7:12

GoogleCodeExporter commented 9 years ago
This is a note about the availability of ADOX. On my Windows Vista Business 
Edition, 
it seems to be installed at %CommonProgramFiles%\System\ado\msadox.dll but I 
could 
verify (at the time of this writing) if it ships with the OS. For Windows 2000 
and 
XP, it seems to come with the OS...

- Microsoft Windows XP Professional Edition
  http://support.microsoft.com/dllhelp/?fid=42083&l=55&det=1

- Microsoft Windows 2000 Professional Edition
  http://support.microsoft.com/dllhelp/?fid=72277&l=55&det=1

Considering this, it seems to be safe to assume that one can depend on ADOX 
being 
available on native Win32 platforms where the .NET Framework can run.

Original comment by azizatif on 8 May 2008 at 7:20

GoogleCodeExporter commented 9 years ago
Following is another MSKB article that may come handy when this area is further 
investigated:

How To Create a Table with Primary Key Through ADOX
http://support.microsoft.com/kb/252908/en-us

Original comment by azizatif on 14 May 2008 at 8:03

GoogleCodeExporter commented 9 years ago
Another one worth bookmarking where there is interesting information about ADOX 
and 
MS Access schema mappings:

Creating and Modifying Access Tables
http://msdn.microsoft.com/en-us/library/aa164917(office.10).aspx

Original comment by azizatif on 14 May 2008 at 9:40

GoogleCodeExporter commented 9 years ago
Taken an initial crack at this in VBScript in r297. See mkmdb.vbs (also 
attached). 
James, would be greate if you can review it.

Original comment by azizatif on 15 May 2008 at 6:13

Attachments:

GoogleCodeExporter commented 9 years ago
Fixed by r401 and r416.

Original comment by azizatif on 4 Nov 2008 at 10:54