-
May 22nd, 2013, 01:06 PM
#1
[RESOLVED] Calling SSIS 2005 Package from C# - Error "Specified cast is not valid"
I hope this is the right place to ask this question. I have web browser application that calling a SSIS 2005 package and I am using VS 2010 and 4.0 .net. When I run the application and it gets to executing the package I get this error: "Specified cast is not valid". I need to pass several parameters to the package, following is my code. I have also tried loading the date variable with the conversion.
Application app = new Application();
Package package = null;
DTSExecResult results;
package = app.LoadPackage(@"\\Bnawpus01\\Public\\bhill\\Projects - SSIS\\OIA CPT Analysis Detail - Payment Split\\CPT Analysis Detail - Payment Split - Prompt\\CPT Analysis Detail.dtsx", null);
package.Variables["User::varDatabase"].Value = Session["Practice"].ToString();
package.Variables["User::varGroupBy"].Value = Session["Practice"].ToString();
DateTime dteStart = DateTime.Parse(Session["FromDate"].ToString());
package.Variables["User::varStartDte"].Value = dteStart.ToShortDateString();
DateTime dteEnd = DateTime.Parse(Session["ToDate"].ToString());
package.Variables["User::varEndDte"].Value = dteEnd.ToShortDateString();
results = package.Execute();
Last edited by godistop1; May 22nd, 2013 at 04:26 PM.
-
May 22nd, 2013, 05:12 PM
#2
Re: Calling SSIS 2005 Package from C# - Error "Specified cast is not valid"
Have you stepped through the code in the debugger to see which parameter the conversion is failing on?
-
May 22nd, 2013, 05:26 PM
#3
Re: Calling SSIS 2005 Package from C# - Error "Specified cast is not valid"
I found the answer, I changed the date parameter to string and package executed correctly.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|