01-15-2008 08:50 AM
Published 04 August 07 02:14 PM
Some of you, as part of a custom installation, need to install a customized database along with customized layouts, reports, etc... If you include such files as part of you custom install, you probably want to attach that database and create a PAD file, such that a user, can easily open this customized database. Here's how you would attach such a database after installing it locally:
FileInfo fi = new FileInfo(dbFile);
string padName = fi.Name.Substring(0, fi.Name.IndexOf(fi.Extension));string dbName;if (!this.ActApplication.ActFramework.ActDatabase.IsEngaged(dbFile, out dbName))
// The database exists, there's just no PAD file, so create onePADFile newPAD = new PADFile(dbName, Environment.MachineName, fi.DirectoryName, ProviderType.Sql.ToString()); padFile = fi.DirectoryName + @"\" + padName + newPAD.Extension;
Now, if you don't include any of the supplemental folders for that database (all the folders under the database's directory - Attachements, Backup, Layouts, Queries, Reports, Templates), then ACT! will automatically create those when the database is attached. If you want to include customized layouts and reports, for example, then copy a new database's supplemental folders and files, replace or add your own files, and copy those alongside the customized database. ACT! will not create the default files if the folders already exist alongside the database.