Build installer for Access in Visual Studio

Murray Brown
Murray Brown used Ask the Experts™
on
Is there a way to build a VB.net solution for installing a Microsoft Access database . I want to deploy a an .exe file that when double clicked installs the Access solution
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
Do you want to create new MS Access dataBase ? In this case, you can use code:
public bool CreateNewAccessDatabase(string fileName)
{
ADOX.Catalog cat = new ADOX.Catalog();
ADOX.Table table = new ADOX.Table();
//Create the table and it's fields. 
table.Name = "Table1";
table.Columns.Append("Field1");
table.Columns.Append("Field2");
    cat.Create("Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + fileName + "; Jet OLEDB:Engine Type=5");
    cat.Tables.Append(table);
    //Now Close the database
    ADODB.Connection con = cat.ActiveConnection as ADODB.Connection;
    if (con != null)
    con.Close();
 
}
} 

Open in new window


Source:
http://zamirsblog.blogspot.com/2010/11/creating-access-database.html

Else if you want to install program MS Access, you can call installation (exe file with specific path) in your program.
Process.Start("C:\YourPaht\install.exe")

Open in new window

John TsioumprisSoftware & Systems Engineer
Commented:
Another way i found recently (but i haven't used it yet) is to embed the Ms Access application as a resource to a VS project.
Check this Article at CodeProject that uses this technique : https://www.codeproject.com/Tips/124562/Create-a-blank-Jet-database
Most Valuable Expert 2012
Top Expert 2014
Commented:
The process of "installing" an Access database can be as simple as copying the file to a local folder, or can be much, much more complex. If all you're doing is copying the Access application to another machine, then you could just use a zip file and leave VS out of the equation. If you have to set references, create shortcuts, handle the registry (to create Trusted Locations, for example), then you'd be much better off using a standard Windows Installer (like suggested on your earlier question) to do this.
Distinguished Expert 2017
Commented:
I use the SamLogic tool

https://www.samlogic.com/

Somehow, I think your time is probably worth more than $99 unless of course this is a training exercise.  In that case, examine some professional tools to see what features they include.
Murray BrownASP.net/VSTO Developer

Author

Commented:
Thanks very much

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial