How to create Access database from xml on server

PhotoCompManager
PhotoCompManager used Ask the Experts™
on
Client side, I can create an Access database (.mdb) file from XML using the Office interop (see below), but this is not available on the IIS server.

How can I create a .mdb file from XML on the server (IIS7) from within an ASPX app?
Imports Microsoft.Office.Interop.Access
Module modAccess
    Private Const acStructureAndData = 2

    Public Function makeMDB(ByVal tempFile As String, ByVal xmlFile As String) As Boolean
        Dim appAccess = New Application
        Try
            appAccess.NewCurrentDatabase(tempFile, AcNewDatabaseFormat.acNewDatabaseFormatAccess2007)
            appAccess.ImportXML(DataSource:=xmlFile, ImportOptions:=acStructureAndData)
        Catch Excep As System.Runtime.InteropServices.COMException
            Return False
        Finally
            appAccess.CloseCurrentDatabase()
            appAccess = Nothing
        End Try
        Return True
    End Function
End Module

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Office applications are not designed to run on server in unattended environments Hence, It is not a good idea to install Access on server. If you could provide more details on why you want to generate access file on server, we can provide more inputs.

Instead, I would suggest you generate CSV file from XML and you can easily import it in Access if required.

Author

Commented:
The server has a version of Access installed - just not the interop DLL which normall lives in the GAC on the client machine

I'm trying to automate a download for an "unsophisticated" user! I can download the XML and let him import that (rather than create a .csv) but I'd prefer to make it seamless.

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