I am currently working on a project where I need to export a database stored within SQL Server into an empty Access database(filename.mdb).
I created a .dtsx file and loaded it in, changed the destination and source connection strings to the locations of the files I wanted, and then executed it - but it isn't outputting the SQL database into my access file, and I am getting an error about being unable to access a process. Here is my code:
Application app = new Application();
Package package = app.LoadPackage(Server.MapPath("COAA Export Access.dtsx"),null);
Connections c = package.Connections;
// create a copy of our database.
FileStream fs = new FileStream(Server.MapPath("empty.mdb"), FileMode.Open);
FileStream output = new FileStream(Server.MapPath("database.mdb"), FileMode.Create);
int i;
do
{
i = fs.ReadByte();
if (i != -1) output.WriteByte((byte)i);
} while (i != -1);
fs.Close();
output.Close();
// change our source database and our destination database
c["SourceConnectionOLEDB"].ConnectionString = ConfigurationManager.ConnectionStrings["COAAConnection"].ConnectionString;
c["DestinationConnectionOLEDB"].ConnectionString = string.Format("Data Source={0};OLD DB SERVICES=0;Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=false;", Server.MapPath("database.mdb"));
// and finally, execute the package to do the copy thing.
package.Execute();
Does anyone know what I might be doing wrong?
Thanks,
Girasquid

New Topic/Question
Reply



MultiQuote




|