MarkMpn / Sql4Cds

SQL 4 CDS core engine and XrmToolbox tool
MIT License
74 stars 22 forks source link

Unhandled exception executing select statement with mismatched datatype in where clause #506

Closed tsileo-wdi closed 1 month ago

tsileo-wdi commented 1 month ago

Hi Mark - I love SQL 4 CDS! Thanks for creating and maintaining it!

I am getting the unhandled exception pasted below every time I try to execute this query with the where clause included:

select wdi_name from wdi_assignmenttype where wdi_workflow = 'Task' ;

If I execute without the where clause, it works just fine.

I finally realized I need to use wdi_workflowname (it's a lookup column), but I'm also thinking you're missing an exception handler somewhere?

Msg 2786, Level 16, State 1, Line 7 The data type of substitution parameter 2 does not match the expected type of the format specification.

See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box.

** Exception Text ** System.NullReferenceException: Object reference not set to an instance of an object. at MarkMpn.Sql4Cds.XTB.SqlQueryControl.ShowResult(IRootExecutionPlanNode query, ExecuteParams args, DataTable results, String msg, QueryExecutionException ex) at MarkMpn.Sql4Cds.XTB.SqlQueryControl.backgroundWorker_RunWorkerCompleted(Object sender, RunWorkerCompletedEventArgs e) at System.ComponentModel.BackgroundWorker.OnRunWorkerCompleted(RunWorkerCompletedEventArgs e)