开发者

Sql Database Server

开发者 https://www.devze.com 2023-01-23 02:50 出处:网络
Hi i have a sql database server runnin on my desktop.I want to create an asp.net application to detect when new data has been inserted into the database.Is there a command in visual studio to detect w

Hi i have a sql database server runnin on my desktop. I want to create an asp.net application to detect when new data has been inserted into the database. Is there a command in visual studio to detect when theres new d开发者_运维知识库ata right away?


Use the timestamp datatype on each column. This will stay identical until a change is made to any column in that row. If you combine this with the rowcount you can be certain if anything has changed in your database. You would need to cache the current timestamps and row count and compare them with the results of a query, you can then find out if there is a change.

So in your answer to:

Is there a command in visual studio to detect when theres new data right away?

Yes there is, although its not a command is the timestamp function (not to be confused with anything to do with the time)

Perhaps you need to provide more details to your scenario since constant querying of the database might not be the best way forward.


You can get a row count of your dataset and create a application

IN VB

Dim i as Integer
i=dataset.tables("table").rows.count

in sql backed return a count of a table and create a ASP.Net website to get the count and when count change alerts you


It may be heavier duty than you are looking for, but SQL Notification Services will do what you want. Essentially you execute a query and tell notification services you want to be notified whenever re-running that query would produce different results.


if you are using caching you can make it dependent on sql.

or you can fire email using sql trigger so when ever trigger get fired you will receive an email.

otherwise you will have to check your db again and again for any changes.

if you can provide more details about exact situation , we can provide more specific solution

You can create a webservice and call it using javascript. here you can find sample how to call webservice using javascript:

 function CallWebservice()
{
 myWebService.isPrimeNumberWebService.callService(isPrimeNumberResult, "IsPrime", 
  testValue.value);
  setTimeout("CallWebservice()",100);//here set time according to your requirement
}

For timer in javascript: http://dotnetacademy.blogspot.com/2010/09/timer-in-javascript.html

For webservice in javaScript: http://www.webreference.com/js/tips/020715.html

How to call webservice in JavaScript for FireFox 3.0

0

精彩评论

暂无评论...
验证码 换一张
取 消