Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Closed Thread
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 11th, 2003, 03:58 PM
Authorized User
Join Date: Jul 2003
Location: Houston, Texas, USA.
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to nvillare
Default Chat Room Trouble

I am trying to create a chat room consisting of 2 pages, the index and the chat room. The index page allows you to login by giving a chat name to use during the session, the chatroom allows you to see the message and insert new messages. However it is not working and I can't figure out what the problem is. Please advice.


<%@ language="VBScript"%>
'code tuns when the form is submitted
'if Go is present then form has beed submitted
if not isempty(Request.Form("Go")) then
 'connection is established
 set MyConn = server.CreateObject("adodb.connection")
 MyConn.Open ("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ="& Server.MapPath("\nvillare\db\nidia.mdb"))
 'session variable chatname is set to name supplied by user
 Session("ChatName") = Request.Form("ChatName")
 'text of thread is set to an empty string
 Session("Thread") = ""

 set RSLastEntry = MyConn.Execute("select Max(ChatID) as MaxID from ChatRoom")
 'checks to see the last entry in the dbs
 'if none then it is set to 0
 if isnumeric(RSLastEntry("MaxID")) then
   Session("LastEntry") = RSLastEntry("MaxID")
   Session("LastEntry") = 0
 end if
 'user is directed to the chat page
 Response.Redirect "./chat.html"
 end if

chat.html consists of body.asp and footer.asp

<% Language=VBScript%>
'connection to the dbs to retrieve any new threads
set MyConn = server.CreateObject("adodb.connection")
MyConn.Open ("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ="& Server.MapPath("\nvillare\db\nidia.mdb"))
'retrieve any new entries entered after the last entry was received
set RSMessage = MyConn.Execute("select ChatID, Message from ChatRoom where " _
 & "ChatID > " & Session("LastEntry"))
'code loops through each record
do until RSMessage.EOF
 'append new message to the current thread
 Session("Thread") = Session("Thread") & RSMessage("Message") &
  'next time page refreshes it will not grab the old message
  Session("LastEntry") = RSMessage("ChatID")

<%@ Language=VBScript %>
'checks to see if the button has been pressed
if not isempty("Request.Form("addMessage")) then
 'if it has been pressed then it will connect to the dbs
 set MyConn = server.CreateObject("adodb.connection")
 MyConn.Open ("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ="& Server.MapPath("\nvillare\db\nidia.mdb"))
 'the message is added to the dbs
 MyConn.Execute "insert into ChatRoom (WhenEntered, Message) values
  (" _
  & "'" & Now & "', " _
  & "'" & Session("ChatName") & ": " & Request.Form("txtMessage") & "')"
  'page is refreshed by redirecting to the chat page
  Response.Redirect "./chat.html"
 end if

Thanks for your help!!


Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Chat Room aliusmankhan ASP.NET 2.0 Professional 2 August 23rd, 2008 07:51 AM
GUI chat room mralam Java GUI 4 October 30th, 2007 04:46 AM
Online Chat Room pro-logic .NET Web Services 0 October 20th, 2003 05:26 AM
Chat Application uxi ASP.NET 1.0 and 1.1 Basics 0 October 1st, 2003 06:27 AM
Chat Room Creation HELP! nvillare Classic ASP Basics 2 August 28th, 2003 06:46 AM

All times are GMT -4. The time now is 12:01 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.