Hello everyone,
I am using the Access.Applicat ion class in my program to import external
data from an excel spreadsheet to my access DB, it's working fine on any
system that has Office 2002 installed, but will throw an exception when it's
running on a machine that has Office 2000 on it... Does anyone know any way
to get around this?
Thanks in advance
Here is my piece of code:
Access.Applicat ionClass access = new Access.Applicat ionClass();
try
{
string dbPath = db.getDbPath();
string table = "tblBookTit le";
access.OpenCurr entDatabase(dbP ath, false, "");
if (openFileDialog 1.ShowDialog() == DialogResult.OK )
{
string file = openFileDialog1 .FileName.ToStr ing();
access.DoCmd.Tr ansferSpreadshe et
(Access.AcDataT ransferType.acI mport,
Access.AcSpread SheetType.acSpr eadsheetTypeExc el9, table, file, true, null,
null);
MessageBox.Show ("Import Successful");
}
}
access.CloseCur rentDatabase();
access = null;
}
catch (Exception exc)
{
MessageBox.Show (exc.Message.To String());
access.CloseCur rentDatabase();
access = null;
}
I am using the Access.Applicat ion class in my program to import external
data from an excel spreadsheet to my access DB, it's working fine on any
system that has Office 2002 installed, but will throw an exception when it's
running on a machine that has Office 2000 on it... Does anyone know any way
to get around this?
Thanks in advance
Here is my piece of code:
Access.Applicat ionClass access = new Access.Applicat ionClass();
try
{
string dbPath = db.getDbPath();
string table = "tblBookTit le";
access.OpenCurr entDatabase(dbP ath, false, "");
if (openFileDialog 1.ShowDialog() == DialogResult.OK )
{
string file = openFileDialog1 .FileName.ToStr ing();
access.DoCmd.Tr ansferSpreadshe et
(Access.AcDataT ransferType.acI mport,
Access.AcSpread SheetType.acSpr eadsheetTypeExc el9, table, file, true, null,
null);
MessageBox.Show ("Import Successful");
}
}
access.CloseCur rentDatabase();
access = null;
}
catch (Exception exc)
{
MessageBox.Show (exc.Message.To String());
access.CloseCur rentDatabase();
access = null;
}
Comment