我正在尝试有关 Windows Workflow 的书中的示例,但出现错误:
用户代码未处理 InvalidCast 异常
无法将“System.DBNull”类型的对象转换为“System.String”类型。
导致错误的确切代码是:
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);
}
该程序将运行,从用户那里得到两个问题:汽车的颜色和制造,然后它会抛出这个错误。有任何想法吗 ?