The MSDE package is *far* to huge to be of any real use at over 70 megs,
Is it? I've got an installer for it called MSDE2000A.exe and it's 43,259KB...
Access has had a bad rep in the past but I'm wondering if recent
versions (like, the last 5 years) have addressed the issues that it had
previously. I remember speed and relability with multiple users were its
two shortcomings.
In my experience, it's very good for any database that is more of the
megabyte size range than the gigabyte size range. It does get a bad press
because of this as people tend to believe it is a 'toy' database, when it's
not - it's just that people try to force too much data through it. When used
correctly, it is a very professional tool and can handle extremely complex
things. It's also very nifty because of its single-file based architecture.
I would also like to know if anyone has any VB.NET code to *create*
Access databases and add DSNs programatically so that I don't have to
rely on the user to set everything up correctly.
No but I've got C# to create one... obviously relies on some version of
Access being installed.
public static bool CreateNewAccessDB(string fullpath)
{
Type accesstype;
object appAccess = null;
try
{
accesstype = Type.GetTypeFromProgID("Access.Application");
appAccess = Activator.CreateInstance(accesstype);
accesstype.InvokeMember("NewCurrentDatabase",
BindingFlags.InvokeMethod | BindingFlags.IgnoreReturn,
null,
appAccess,
new object[]{fullpath});
accesstype.InvokeMember("Quit",
BindingFlags.InvokeMethod | BindingFlags.IgnoreReturn,
null,
appAccess,
null);
return true;
}
finally
{
if(appAccess != null) Marshal.ReleaseComObject(appAccess);
appAccess = null;
}
}
I converted it to VB.NET at
http://www.developerfusion.com/utilities/convertcsharptovb.aspx
and it comes out as this: (although I haven't tested it)
Public Shared Function CreateNewAccessDB(ByVal fullpath As String) As Boolean
Dim accesstype As Type
Dim appAccess As Object = Nothing
Try
accesstype = Type.GetTypeFromProgID("Access.Application")
appAccess = Activator.CreateInstance(accesstype)
accesstype.InvokeMember("NewCurrentDatabase", BindingFlags.InvokeMethod
Or BindingFlags.IgnoreReturn, Nothing, appAccess, New Object() {fullpath})
accesstype.InvokeMember("Quit", BindingFlags.InvokeMethod Or
BindingFlags.IgnoreReturn, Nothing, appAccess, Nothing)
Return True
Finally
If Not (appAccess Is Nothing) Then
Marshal.ReleaseComObject(appAccess)
End If
appAccess = Nothing
End Try
End Function
I suppose if you were sneaky you could get around the necessity to have a
version of Access installed, and just store the bytes of a blank Access DB in
a resource of your assembly, and then just spool it off into a file to create
one... not sure about the legality of this though ;-)
A DSN is just a text file in a certain directory, like "c:\program
files\common file\odbc\data sources" or something, have a look at some
existing ones to glean the format, although DSNs are about as fashionable
these days as DDE...