Results 1 to 18 of 18

Thread: Listen to database for new insert??????

  1. #1

    Thread Starter
    Fanatic Member d2005's Avatar
    Join Date
    Aug 2005
    Location
    ireland
    Posts
    620

    Listen to database for new insert??????

    does anyone know how to refresh page

    on my webform is a datagrid which reads messages from a database
    when a new message comes in it is saved to the database
    but for me to see a new message in my datagrid i have to press refresh,

    i want this page to be as live as possible,

    i.e. refresh constantly

    any ideas much appreciated
    Last edited by d2005; Sep 23rd, 2005 at 04:45 AM.
    it works 60% of the time, all the time.

  2. #2

    Thread Starter
    Fanatic Member d2005's Avatar
    Join Date
    Aug 2005
    Location
    ireland
    Posts
    620

    Re: refresh page

    i got the page to refresh but i dont think its what i need
    alls i hear is kk kk kk kk every time its refreshed
    besides my datagrid will have controls on it


    how can i update my datagrid when a new msg comes into databse
    it works 60% of the time, all the time.

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: refresh page

    alls i hear is kk kk kk kk every time its refreshed
    This is the most paranormal programming problem I have ever come across.

  4. #4
    Addicted Member
    Join Date
    Feb 2002
    Location
    closed
    Posts
    196

    Re: refresh page

    Quote Originally Posted by mendhak
    This is the most paranormal programming problem I have ever come across.
    it's a known issue, should be MN MN MN MN - taken care of in the next service pack i believe


  5. #5
    Fanatic Member -TPM-'s Avatar
    Join Date
    Jul 2005
    Posts
    850

    Re: refresh page

    You could use AJAX....
    TPM

    Add yourself to the VBForums Frappr Map!!

  6. #6
    Fanatic Member
    Join Date
    May 2005
    Posts
    608

    Re: refresh page

    You could try to use an html meta tag,

    <META HTTP-EQUIV="refresh" content="1;URL=http://www.vbforums.com">

    This refreshes a page every second. You have to change the 1 for the ammount of seconds you want the page to stay still before it refreshes.

    HTH

  7. #7

    Thread Starter
    Fanatic Member d2005's Avatar
    Join Date
    Aug 2005
    Location
    ireland
    Posts
    620

    Re: refresh page

    lol, KK KK KK KK is the wee noise that IE makes when it refreshes
    i put in web config file to refresh the page every second and the on noise would drive you insane


    MY PROBLEM
    basically i have sms messages coming into database
    i set up a datagrid to read from database the messages that are sent in
    but i need this datagrid ( or however im going to display this information) to update when a new message comes into database.......

    but this display will also have a reply button which shall write to the database and send out.
    therefore i dont think i can refresh the whole page this way.
    does any one know how to keep a table or datagrid 'live' where as it recognises a new message has come in and therefore will populate my display information accordingly
    it works 60% of the time, all the time.

  8. #8
    Addicted Member
    Join Date
    Feb 2002
    Location
    closed
    Posts
    196

    Re: Listen to database for new insert??????

    nah, i cant see how you can easily keep your grid 'real time' . the web is stateless in that the your client (browser) is uaware of the server - you could force the page autorefresh every n-minutes as HoraShadow suggests and redisplay the contents of your database table in the grid - resource heavy and no doubt a frustrating experience for any user (page refreshing).

    personally i would reconsider the design - use a 'check for mew messages' button and/or maybe use email or sms to send notifications of new messages


  9. #9
    Fanatic Member
    Join Date
    May 2005
    Posts
    608

    Re: Listen to database for new insert??????

    You could split the page into two sections:

    a) The whole page without the datagrid. It would have where you type your messages and all the other info, that doesn't have to reload so you don't lose what you are typing.
    b) An iframe with the datagrid inside, with the command to refresh every xx seconds.

    That way the only thing that refreshes is the iframe, the rest of the page remains static.

    But to keep it 'live' just when you have a message, I don't know how you could do that with plain .NET, unless you use something else, like flash to do that.

    The Microsoft's Web messenger does this tough, so it can be done and look really good. You can check it out at http://webmessenger.msn.com/

  10. #10

    Thread Starter
    Fanatic Member d2005's Avatar
    Join Date
    Aug 2005
    Location
    ireland
    Posts
    620

    Re: Listen to database for new insert??????

    is there a way to send like a popup etc... to notify the user of a new incoming message, then they can refresh it manually if you get where im coming from

    its basically like a messenging service but the messages are saved to database first
    it works 60% of the time, all the time.

  11. #11
    Addicted Member
    Join Date
    Feb 2002
    Location
    closed
    Posts
    196

    Re: Listen to database for new insert??????

    lots of ways - i'm sure there are 3rd party messenger apps, SQL Notification Services or even a plain old trigger on your database table that runs a NET SEND command when a record is inserted. but these would all have to be external to your web app and would require seperate development


  12. #12

    Thread Starter
    Fanatic Member d2005's Avatar
    Join Date
    Aug 2005
    Location
    ireland
    Posts
    620

    Re: Listen to database for new insert??????

    yes powdir this seems to be the way to do it,

    the thing is you see is that the application that recieves the sms and gets them into database is an external application,
    my web app only needs to read from the database
    but i need the reading of a new insert to be done immediately more or less,
    could you please expand on the notification services or net send
    any tutorials etc......
    it works 60% of the time, all the time.

  13. #13
    Addicted Member
    Join Date
    Feb 2002
    Location
    closed
    Posts
    196

    Re: Listen to database for new insert??????

    i fully understand what your trying to do

    having the web page force a refresh when there might not be new records present is inefficient and clumsy. I've never looked at the webmessenger stuff HoraShadow mentions so i cant comment

    NET SEND is old hat but if your users are all on the same network it might be a cheap workaround, google that and "SQL Notification Services" for the requirements/tutorials. Bottom line - if your web app can access the db tables then so can a helper app that fires some sort of notification event when a record is inserted. like i said consider moving the WHOLE notification mechanism out of the web app.


  14. #14

    Thread Starter
    Fanatic Member d2005's Avatar
    Join Date
    Aug 2005
    Location
    ireland
    Posts
    620

    Re: Listen to database for new insert??????

    yeah i think the net send maybe the stuff, as sql notification seems to be a download

    is there anyone with experience of net send
    could anyone take me through the steps involved
    i.e. set up new column in database
    write this procedure etc...

    im looking to notify a user on a web app that a new entry is made to a database
    im a net send first timer
    it works 60% of the time, all the time.

  15. #15
    Addicted Member
    Join Date
    Feb 2002
    Location
    closed
    Posts
    196

    Re: Listen to database for new insert??????

    NET SEND is an network admin tool - it's NOT a elegant solution, more a simple workaround hack. but if you must (and the network allows for it)

    1) create a subscribers table - this will hold the names and network addresses of those interested in receiving notifications (subscribers)
    2) create a trigger on the existing messages table that fires on an insert, within the trigger use a cursor to loop through the subscribers table.
    3) for each record in subscribers execute a xp_cmdshell 'NET SEND' on the network address field. continue to loop through the subscribers table until all the entries have been notified.

    I only use this for debugging.

    ..it also makes for a nice wind up.


  16. #16

    Thread Starter
    Fanatic Member d2005's Avatar
    Join Date
    Aug 2005
    Location
    ireland
    Posts
    620

    Re: Listen to database for new insert??????

    thanks powdir
    im gonna give this a go first because basically i need to show something working by mid next week,
    then i can let it run and go into more depth in the application and continue development

    one thing i just want to make sure,
    this net send will be on a web app, so therefore it shall be on the internet,
    does this possible solution apply to the internet,

    all your help has been much appreicated and has given me ideas of how to resolve my problems ( as first i was starting off to refresh page)
    it works 60% of the time, all the time.

  17. #17
    Addicted Member
    Join Date
    Feb 2002
    Location
    closed
    Posts
    196

    Re: Listen to database for new insert??????

    no NET SEND only works on a local network (i mentioned this earlier!) - i can't offer a step-by-step solution here, only suggestions and my biggest one is to remove the notification mecahnism from your web app. use NET SEND only on toy apps, for debugging or as a proof of concept

    good luck


  18. #18

    Thread Starter
    Fanatic Member d2005's Avatar
    Join Date
    Aug 2005
    Location
    ireland
    Posts
    620

    Re: Listen to database for new insert??????

    lol
    im gonna need all the luck in the world
    thanks
    it works 60% of the time, all the time.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width