Click here to Skip to main content
15,884,177 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
ASP.net Notification pop up for new records on Screen when new record insert in database .
Posted
Updated 21-Apr-17 20:16pm
v2

 
Share this answer
 
One of the best options would be to use SignalR and SQLDependency. Enable SQLDependency which will notify to the server whenever a new record get inserted and then use SignalR that will notfy to the client. For details look to the below links

SQLDependency http://techbrij.com/database-change-notifications-asp-net-signalr-sqld[^]

http://stackoverflow.com/questions/9880155/using-signalr-with-sqldependency-to-push-database-updates[^]
 
Share this answer
 
<script> var old_count = 0;
var i = 0;
setInterval(function(){    
$.ajax({
    type : "POST",
    url : "notifi.php",
    success : function(data){
        if (data > old_count) { if (i == 0){old_count = data;} 
            else{
            alert('New Enquiry!');
            old_count = data;}
        } i=1;
    }
});
},1000);</script>


next file add is notifi.php
<?php
include('db.php');
$sql = "SELECT count(*) as count FROM message";
$qry = mysql_query($sql);
$rowq = mysql_fetch_assoc($qry);
echo $rowq['count'];
?>
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900