Avatar of PhotoCompManager
PhotoCompManager

asked on 

How to create Access database from xml on server

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

Microsoft DevelopmentMicrosoft IIS Web ServerMicrosoft Access

Avatar of undefined
Last Comment
PhotoCompManager
ASKER CERTIFIED SOLUTION
Avatar of Maulik Modi
Maulik Modi

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of PhotoCompManager
PhotoCompManager

ASKER

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.
Microsoft Access
Microsoft Access

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.

226K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo