Hi everyone,

I need to write a very simple chat application that lists who is online and relay the messages in a chat textbox for everyone. I can use MSSQL for this. So how is the best way to do this? When someone writes a message to go in the chat textbox I assume it gets written in a table with the date and time. How do I know which messages to pull from the table to show? Do I save the latest record number and retrieve all from that one and higher on each query?

And second, what is the best way to tell who is online? If a user closes their browser it won't always send an update to the sql server to mark them offline. Do I send an update from the user every 15 seconds and if anyone doesn't update within 30 seconds they are offline?