troubleshooting Question

How to create Access database from xml on server

Avatar of PhotoCompManager
PhotoCompManager asked on
Microsoft DevelopmentMicrosoft IIS Web ServerMicrosoft Access
2 Comments1 Solution486 ViewsLast Modified:
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

ASKER CERTIFIED SOLUTION
Maulik Modi

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros