[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

ASP.NET C# periodically updating website value from SQL

Posted on 2014-08-11
3
Medium Priority
?
460 Views
Last Modified: 2014-08-12
Hi

I have a website which is displaying data from an SQL database. The data in the database is updated about once every second. At the moment I am using a timer on the website to execute a stored procedure which gets the new value from the database, and then updates the value on the site using an UpdatePanel. The timer "ticks" every 0,8 seconds.

I want the value on the website to be as close to "real-time" as possible, and I was wondering if this is the most effective way of doing this?

Is it possible of "push" the value from the SQL database directly to the website when a new value is inserted into the table using a database trigger?
0
Comment
Question by:poultarp
  • 2
3 Comments
 
LVL 25

Expert Comment

by:Luis Pérez
ID: 40252778
As far as I know, you can't do that. Note that the value you're showing into your website is taken from SQL Server, so when you show the value it's the right, exact value stored in the database in that moment.

Why do you want to do "fine tuning" in this? Is the way you're using to get the value time-expensive? Is there a heavy delay from the moment in which the value is stored in SQL to the moment in which is shown in your website?
0
 
LVL 1

Author Comment

by:poultarp
ID: 40252791
Hi Luis

Using the timer works as it should. I was just wondering if there was a way to do this with having to run a stored procedure ever 0,8 second.

I know you can trigger events in the SQL database using triggers, and I was just wondering if it was possible to update a website value from SQL.
0
 
LVL 25

Accepted Solution

by:
Luis Pérez earned 2000 total points
ID: 40252812
Well, I think there's not way to "push" value directly from SQL Server to a web site.

Think that a user viewing your web site has made a request to your site. That request has been intercepted by your code and you can do many things in response (for example, reading a value from SQL by calling a stored procedure) and, finally, you send the response to the client. So, directly from SQL Server, how do you publish the value to the web site? To what client/s?

Actually, you're using the best method to do this based on yourk knowledge of your business rules (the value in SQL changes every second).

Hope that helps.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Suggested Courses

825 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