Page 1 of 1

Notifications

Posted: Sun 22 Mar 2015 11:47
by LHSoft
Hello,

I have 4 tables on a form I want to set notifications.
All tables are set to read only.

If so, I can activate notifications for max. 2 of them, it does not matter what combination. If activating 3 or 4, i get an error message: Statement does not support notifications.

But if setting Read Only for all 4 tables to false, there is no problem.

So my question: is this a bug or what is the reason for the error Statement.

best regards
Hans

Re: Notifications

Posted: Sun 22 Mar 2015 15:29
by LHSoft
Hello,

and another question regarding notifications:
notification statements do not like table.refresh!

But sometimes it is necessary to ensure that table is up to date right now and cannot wait until notification will arrive.
Is there another way (then Table.Refresh)to tell the table to update data right NOW when notification statement is used?

best regards
Hans

Re: Notifications

Posted: Thu 26 Mar 2015 13:13
by azyk
The 'Statement does not support notifications' error message occurs when a SQL query in the dataset doesn't meet the MSDN requirements on using Notification ( https://msdn.microsoft.com/en-us/library/ms181122.aspx ). If you are using TMSTable as a dataset, then the SQL query will be generated in the following view:

Code: Select all

SELECT * FROM TABLE_NAME
and will be restricted by the following:
The statement may not use the asterisk (*) or table_name.* syntax to specify columns.

To solve the problem, do the following:
- replace the TMSTable component with the TMSQuery one for all the datasets, that use Notification;
- compose SQL queries manually for these datasets, so that they meet the above MSDN requirements. For example, instead of the a SQL query like:

Code: Select all

SELECT * FROM DEPT
compose such a query:

Code: Select all

SELECT DEPTNO, DNAME, LOC FROM dbo.DEPT

Re: Notifications

Posted: Fri 27 Mar 2015 00:50
by LHSoft
I do so already:
Form.Create: (Where TbLagBes is a TMSTable)
TbLagBes.SQL.Clear; SQLFields := '';
for i := 0 to TbLagBes.Fields.Count - 1 do
if i < TbLagBes.Fields.Count - 1 then
SQLFields := SQLFields + TbLagBes.Fields.FieldName + ','
else
SQLFields := SQLFields + TbLagBes.Fields.FieldName;
TbLagBes.SQL.Add('select ' + SQLFields + ' from dbo.MoLagBes');
TbLagBes.LockMode := lmPessimistic;
TbLagBes.ChangeNotification := DBM.StmKunCN;

Nofitication work fine as long as Tables are not set ReadOnly or there is no Table.refresh

Hans

Re: Notifications

Posted: Fri 27 Mar 2015 08:12
by azyk
We have tried to reproduce the problem according to your code, but it wasn't reproduced. Please try to compose a small test project demonstrating the problem. Include the test tables creating scripts and send them to andreyz*devart*com .