[DUG] SqlDependency

David O'Brien Dave at iccs.co.nz
Tue Apr 3 10:14:14 NZST 2012


Yes, thanks. That is the solution at the moment, I thought there may be a more elegant one :-)
Crosstalk looks to be a brilliant solution for a number of issues here (mixed .net and native).

________________________________

From: delphi-bounces at listserver.123.net.nz on behalf of Xander van der Merwe
Sent: Tue 3/04/2012 9:51 a.m.
To: 'NZ Borland Developers Group - Delphi List'
Subject: Re: [DUG] SqlDependency



I very simple (but reliable) alternative approach might be to periodically (say every 30 seconds or whatever makes sense for your app) fire a simple query like "select max(DateUpdated) from MyTable" (assuming you have a DateUpdated column) and if the result returned is greater than the last value you have, you just do a refresh on that particular table/query in the UI.

 

Regards

 

From: delphi-bounces at listserver.123.net.nz [mailto:delphi-bounces at listserver.123.net.nz] On Behalf Of David O'Brien
Sent: Tuesday, 3 April 2012 8:47 a.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] SqlDependency

 

Thanks.

 

From: delphi-bounces at listserver.123.net.nz [mailto:delphi-bounces at listserver.123.net.nz] On Behalf Of Jolyon Smith
Sent: Tuesday, 3 April 2012 8:08 a.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] SqlDependency

 

As far as I can tell, SQLDepedency is just a high level wrapper around SQL Server Query Notifications - you could (if someone hasn't done it already) create such a high level wrapper yourself, or just build what you need on the core services themselves.  Instead of Google'ing "SQLDependency", try instead "SQL Server Query Notification".

These articles in particular may be useful:

http://msdn.microsoft.com/en-us/library/ms130764.aspx

http://www.simple-talk.com/sql/t-sql-programming/using-and-monitoring-sql-2005-query-notification/

You will note that there is quite a bit of infrastructure required in the DB itself to get this stuff up and running and there are some quite specific conditions that have to be met by the query itself - it's not just a case of "notify me about this query".  At the very least you need a queue and Service Broker to be running.  Whether you are in a position to put that infrastructure in place may determine whether or not this approach is even viable in your case.


hth





On 3 April 2012 02:33, Jackson Gomes <jfdmg at hotmail.com> wrote:

you may try CrossTalk, which allows you to import .NET classes and Libs and use them on Delphi

 

http://www.atozed.com/crosstalk/index.en.aspx 

________________________________

Date: Mon, 2 Apr 2012 11:49:25 +1200
From: Dave at iccs.co.nz
To: delphi at listserver.123.net.nz
Subject: [DUG] SqlDependency

 

I would like to get SQL Server (2008 R2) to notify my app when data in a table changes.

I'm looking for something like the SqlDependency class in .net, but for an XE2 VCL (Pascal) app.

Does anyone know of a component, class, or way to replicate this (Not .net)?

 

Cheers,

Dave.

 

_______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: delphi at listserver.123.net.nz Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to delphi-request at listserver.123.net.nz with Subject: unsubscribe


_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi at listserver.123.net.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-request at listserver.123.net.nz with Subject: unsubscribe

 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 8244 bytes
Desc: not available
Url : http://listserver.123.net.nz/pipermail/delphi/attachments/20120403/66d52d95/attachment-0001.bin 


More information about the Delphi mailing list