I have found a strange “problem” when I use, server side, the DynamicWhere.
The problem is this (I use the last 10.0.0.1467 version for Delphi):
in DASchemaModeler I defined a new datatable with AutoSQL statment. In this case when I use the DynamicWhere (only to server side) when run the code the system raise an exception that the param :DAPARAM_1 is not found.
If I set the same datatable with SQL (the DASchemaModeler create automatically the statment with the {WHERE} macro) and I not modified it everything works regularly.
It seems that when working in AutoSQL (and only on the server side) the macro {WHERE} is not recognized.
Is this actually a problem or am I doing something wrong?
NewDataset method has overload method that accepts DynamicWhere expression as xml string. if you pass DynamicWhere XML to that overload method, will it solve this issue in AutoSQL mode?
this is AlwaysGenerateDynamicWhereStatement parameter, that is has False value by default. if aWhereClause isn’t specified, SQL is generated w/o WHERE {WHERE} line.
workarounds:
pass non-empty aWhereClause
pass AlwaysGenerateDynamicWhereStatement parameter with True value in overloaded method.
you are right. better code:
with Connection.GetWhereBuilder do begin
Expression := NewBinaryExpression(NewField('', 'LOGIN_NT'), dboEqual, AUserName, datString);
sXml := Xml;
Free;
end;