1

I guess the answer is no, but I'm asking anyway: SQL Server 2005 and later supports the implementation of live views on queries through the service broker mechanism. The .NET class SqlDependency uses this facility. SQL Server CE doesn't support it.

I'm wondering: If there's any edition of SQL Server I'd want to have live views on queries, it's going to be CE, isn't it? After all, that's the one I will most likely want to run a responsive, interactive GUI against. Is there an alternative mechanism to implement live views on queries with CE or do have make due with polling?

John
  • 6,693
  • 3
  • 51
  • 90

2 Answers2

0

You can bind your GUI against SqlCeResultSet, which is a live cursor over the underlying data.

ErikEJ
  • 40,951
  • 5
  • 75
  • 115
  • Thanks I didn't know that. Unfortunately there don't seem to be the appropriate controls to bind to it. Binding appears to be designed for WinForms, but even those don't update unless you click on a cell. But that's probably not a problem on the database api layer. – John Jan 20 '12 at 17:26
0

SQL CE is an in-process server. Therefore you don't have the issue of concurrent access and the difficult problem of detecting changes made by other processes. On the big SQL Server this problem is addressed by Query Notifications, leveraged in the client by SqlDependency and friends.

Since in SQL CE case there will be only one process changing the data (your process!) you will always know when/what data changed and you can refresh your views accordingly.

Remus Rusanu
  • 288,378
  • 40
  • 442
  • 569
  • I know when the data changes in the sense that I could theoretically hand-code the logic that is required to implement all refreshing that's needed. But that something between tedious and difficult, depending on the scenario. Image an arbitrary query using a join on various conditions and now I change one row in one of the concerned tables. Do I have to update? This is non-trivial problem and I would have thought it's the databases job to solve it for me. – John Jan 19 '12 at 21:00
  • In particular, name me one general-purpose database browser that browses either sql server or ssce and updates its own query results on the modifications it does itself. I don't know any. – John Jan 20 '12 at 17:29
  • The conclusions re: SSCE seem wrong in this answer. SSCE does support concurrent access within the application and even across applications. I'm looking into the same scenario - one application updating the database and another application wanting to provide near real-time views of that same database. It'd be nice if SSCE provided a means of doing this. – Matt Davis Jul 17 '12 at 00:13