When you have a select * from XXX query eventually you can get more fields than you expected, do you know if there is a way to check if new fields have been added since you created that query and defined its persistent fields ?.
Normally you can open your queries without having to worry if new fields have been added. If new fields are not within your persistent fields then you just won't see them. But on a Datasnap REST Server you get an AV when trying to return a Dataset from a query that now has more fields than when you created its persistent fields.
If would like to know if there is a quick check that I can do so I can return a more helpful error instead of an AV.
Something like :
MyQuery.Open;
if MyQuery.FieldDefs.Count <> MyQuery.Fields.Count then begin
raise Exception.Create('The number of returned Fields doesn''t match the expected');
end;
Thank you
Use the Query Store page in SQL Server Management Studio In Object Explorer, right-click a database, and then select Properties. Requires at least version 16 of Management Studio. In the Database Properties dialog box, select the Query Store page. In the Operation Mode (Requested) box, select Read Write.
Multiple criteria in a single row When you use criteria for more than one field, and put them all in the Criteria row of the query grid, Access assumes that you mean to join them with AND. So a record must meet all criteria within that row in order to be displayed on the datasheet.
You can count the number of items in a field (a column of values) by using the Count function.
If the dataset has persistent fields and you want those additional fields to be created when the query opens, you have to set dataset.FieldOptions.AutoCreateMode
to acCombineAlways
first.
Now after opening the query, you can check for the existance of additional fields with lcAutomatic in dataset.Fields.LifeCycles
.
In case you are interested in which fields are new, just iterate dataset.Fields
and check for field.LifeCycle = lcAutomatic
.
BTW, using the setting above you probably might not need that check anymore.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With