MS-Access / Getting Started

Setting Build Properties on the Source Database

Setting properties on the source database is straightforward at this point. We simply need to call the SetDatabaseProperty method for the specified properties. Add the following code to implement the SetSourceProperties method:

private void SetSourceProperties()
{
    // open the source database
    sourceDatabase = myEngine.OpenDatabase(
	inputDatabase.Text,
	false,
	false,
	Type.Missing);
    // set the properties
    SetDatabaseProperty(sourceDatabase, SRC_PRP_STARTDATE,
	DAO.DataTypeEnum.dbDate, appStartDate.Value.ToShortDateString());
    SetDatabaseProperty(sourceDatabase, SRC_PRP_TARGET,
	DAO.DataTypeEnum.dbText, outputDatabase.Text);
    SetDatabaseProperty(sourceDatabase, SRC_PRP_APPMAJOR,
	DAO.DataTypeEnum.dbLong, appVersion.Text.Split('.')[0]);
    SetDatabaseProperty(sourceDatabase, SRC_PRP_APPMINOR,
	DAO.DataTypeEnum.dbLong, appVersion.Text.Split('.')[1]);
    SetDatabaseProperty(sourceDatabase, SRC_PRP_APPREVISION,
	DAO.DataTypeEnum.dbLong, appVersion.Text.Split('.')[3]);
}
[Previous] [Contents] [Next]