Solved

SignalR - getting new data from sql DB

Posted on 2016-10-25
5
137 Views
Last Modified: 2016-11-09
Im looking at SignalR, however i'm a little confused about how it will update based on new data

I have a sql server 2014 enterprise table called tblAssets
On this table is a column called LatestRecordId

This contains the latest ID from a table called tblAssetLogs

Currently, every 30 seconds I use long polling to get the latest asset log data.

What i want to do:
1. every time tblAssets.LatestRecordId is changed, then push the new data to the client

Does anyone know if this is possible? and how i would achieve this?

I'm using .net framework 4.5 and iis7 on windows 2008 r2
0
Comment
Question by:websss
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 13

Expert Comment

by:Nakul Vachhrajani
ID: 41858574
Based on your requirement, it seems that you need transactional replication between the Assets database (article to replicate would be based on the data to be exchanged with the client) and the client database.
0
 

Author Comment

by:websss
ID: 41858581
I'm not sure what that means
But in a nutshell
When an ASSET sends new data to the server, we insert it into the LOG table, and then use the newly inserted records ID to update the ASSETS table (tblAssets.LatestRecordId)

When this ID changes, it needs to push to the client as the data needs to be refreshed on their browser

how do we do that?
0
 
LVL 13

Expert Comment

by:Nakul Vachhrajani
ID: 41858689
Oh, refreshed on the browser application. I thought it was to be sent over to another database/database system. Sorry.

You can have a ROWVERSION column on your dbo.tblAssets tables. This data should be stored in your session. What you need is a process on the client side that regularly polls the database for changes by checking to see if the ROWVERSION has changed (it will automatically change when you update the data in the table), and if a change is detected, refresh the UI.

Database systems, unlike front-end applications do not have the ability to "fire" a message - they are data storage and processing areas and once processed, the requesting application has to pick up the data (like a kitchen, for example - an order comes in, it is serviced and then the banquet staff must periodically check and pick it up if the meal is ready).
0
 

Author Comment

by:websss
ID: 41858696
hmmm
this is long polling, and i do this already
Kinda outdated now
0
 
LVL 13

Accepted Solution

by:
Nakul Vachhrajani earned 500 total points
ID: 41858719
If you use Service Broker (available on Enterprise & Standard only), you may want to explore using Query Notifications: http://www.codeproject.com/Articles/144344/Query-Notification-using-SqlDependency-and-SqlCach
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
I have a large data set and a SSIS package. How can I load this file in multi threading?
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question