make a popup html window based on SQL Trigger Values ?

Posted on 2004-11-18
Medium Priority
Last Modified: 2012-06-21
i'm trying to make a small popup html window on the right bottom corner of user screen,,

this window is created based on a tigger on a table ,when ever
a row is inserted to a user a window well popup on his/her screen..

i need that to look as an Email Notification, or an alert to the user.

i'm developing in Vb.Net & SQL Server..
is there a way to do that , or any idea,,
Question by:star4
  • 2

Expert Comment

ID: 12624718
WWW is a pull technology, the user's web browser has to request a page from the server. There is no way the server can push a message to the client's machine to do the popup.

So you need to fake it. You would have to have an HTML page that used a javascript timer, or a meta refresh to reload itself. When reloaded, if it needed to alert the user it would have to create a new window via javascript and position it in the bottom corner.

It would also have to have at least a title bar and close button, you could remove the toolbar and address bar, but it's never going to look quite like an Email Notification alert.

You can find the screen width and height from the screen object, so you'd create a new window and place it in the corner something like:

var left = screen.width - desiredwindowwidth;
var top = screen.height - desiredwindowheight
var hwnd = window.open('alertwindow.html','alert','left='+left+';top='+top);

You woun't be able to fire it from the trigger.

Author Comment

ID: 12637385
if it is not possible , how is Microsoft MSN messanger is working ????
What about Norton AntiVirus Live Update ??????

Accepted Solution

eyeh8u earned 800 total points
ID: 12637418
It is not possible to trigger an event on a remote client machine via a SQL Server Trigger.

MSN Messenger, Microsoft Outlook and Norton etc are client applications running on the users machine. MSN messenger maintains a stateful connection to a remote server, when it receives a message on it's TCP connection that there is a new message/login/whatever it then uses the Win32 API to create a new window with no border, place it in the bottom corner of the screen and then draws it's interface over it.

To do this, you would have to:
1) Have the trigger insert a row into some kind of "Notification" table
2) Write a VB.NET WINDOWS application that sits on the clients machine running constantly
3) The VB.NET program would have to connect to the database and poll the notification table (do a SELECT on it every x minutes)
4) When it detects a notification, it would remove it so it doesn't trigger again and then use the Win32 api to create a new window with no border and draw the custom interface over it.

It's not possible to make an "Email Notification" style window from HTML and have it appear based on a sql server trigger. It's not possible to have any window appear based on a SQL Server Trigger, triggers execute sp's and SQL statements and functions WITHIN the database.


Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Suggested Courses

840 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