/// <summary> /// Imports a database table from a text archive file, dropping any existing table. /// </summary> /// <param name="importFilePath">Path to the file to be imported. /// The table name is specified within the file.</param> /// <exception cref="FileNotFoundException">the file path is invalid</exception> /// <exception cref="InvalidHandleException">the Database handle is invalid</exception> /// <remarks><p> /// Win32 MSI API: /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msidatabaseimport.asp">MsiDatabaseImport</a> /// </p></remarks> public void Import(string importFilePath) { if (String.IsNullOrEmpty(importFilePath)) { throw new ArgumentNullException("importFilePath"); } FileInfo file = new FileInfo(importFilePath); uint ret = NativeMethods.MsiDatabaseImport((int)this.Handle, file.DirectoryName, file.Name); if (ret != 0) { if (ret == (uint)NativeMethods.Error.BAD_PATHNAME) { throw new FileNotFoundException(null, importFilePath); } else { throw InstallerException.ExceptionFromReturnCode(ret); } } }