views:

79

answers:

3

I'm trying to call my assemblys SP and receive the following error:

A .NET Framework error occurred during execution of user-defined routine or aggregate "Pmt_ImportJournal": 
System.InvalidCastException: Specified cast is not valid.
System.InvalidCastException: 
   at JournalImport.Pmt_ImportJournal(Int32 orderno)

My SP in the assembly is defined like so:

[SqlProcedure(Name = "Pmt_ImportJournal")]
public static void Pmt_ImportJournal(int orderno)

Should I be using the SQL* datatypes instead of simply an int in the signature? For example SqlInt32?

A: 

how are you calling the function. are you sure that the orderno is an int?

Josh

Josh
positive.... calling like so:EXEC Pmt_ImportJournal 1309
Chris Klepeis
can you post the rest of the function code so we can take a look - thanks.
Josh
A: 

Have you tried looking at the signature of the stored procedure that is created? Also, is it possible that there's a cast error farther down in your method?

Shane Fulmer
A: 

Check inside the Pmt_ImportJournal method. Some line of code inside there is likely to be raising the exception.

John Fisher