Saturday, 7 September 2013

WF C# VS2012 - InvalidCast Exception was unhandled by user code?

WF C# VS2012 - InvalidCast Exception was unhandled by user code?

I was trying an example from a book on Windows Workflow and I got an error :
InvalidCast Exception was unhandled by user code
Unable to cast object of type 'System.DBNull' to type 'System.String'.
The exact code causing the error is :
try
{
// Send data to workflow!
IDictionary<string, object> outputArgs =
WorkflowInvoker.Invoke(new CheckInventory(), wfArgs);
// Print out the output message.
Console.WriteLine(outputArgs["FormattedResponse"]);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
The program will run, taking two questions from the user: color & make of
a car and it then throws up this error. Any ideas ?

No comments:

Post a Comment