Add DLL:
Microsoft.server.SqlServer.ManageedDTS
string serverFileName = Path.GetFileName(fpUploadIncome.PostedFile.FileName);
fpUploadIncome.PostedFile.SaveAs(MapPath("~//UploadedFiles/") + serverFileName);
string path = Path.GetFullPath(fpUploadIncome.PostedFile.FileName);
Microsoft.SqlServer.Dts.Runtime.Application app = new Application();
Package oPack = null;
Variables oVar;
oPack = app.LoadPackage(@"C:\Package\uploadIncome.dtsx", null);
oVar = oPack.Variables;
oVar["FilePath"].Value = "C:\\income.xls";
oVar["FilePath"].Value = path.Trim().ToString();
Microsoft.SqlServer.Dts.Runtime.DTSExecResult Results = oPack.Execute();
//Microsoft.SqlServer.Dts.Runtime.DTSExecResult Results = oPack.Execute(null, oVar, null,null, null);
if (Results == DTSExecResult.Success)
{
//msgDetails.Show(MyMessageBox.MessageType.Success, "Data uploaded succssfully");
//Execution Success
}
else
{
//msgDetails.Show(MyMessageBox.MessageType.Success, "Error while uploading file");
// excution fails
}
Comments
Post a Comment