Deleting Records using ASP

Posted on 2003-03-02
Medium Priority
Last Modified: 2011-09-20
Hello i have created a table named LoginStatus which has the following Fields: Username, Password, Time.  

I update this Table every time that my users login on my intranet(by getting their username,Ip address and login time) so as to have some connection status of my intranet...

Up to here is working just fine...

Now what i want to do is when the users click the logout button i want their entry which was added during login to be deleted from the Table. I want the ASP or SQL command that will enable me to do this.

Thank you
Question by:globemast
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 8051309
Format is this:

DELETE FROM table_name
WHERE column_name = some_value

So you could put username as colum_name and then the persons actual username as some_value

Eg: WHERE username = JennyRo

Accepted Solution

nareerat earned 200 total points
ID: 8055593
file : Frm.asp
       call asp file when user logout
'*** you have to connection at database.inc.asp already ,so #include file in delete.asp
'*** if not, add connection in delete.asp file
file : delete.asp
<!-- #include file="../../includes/database.inc.asp" -->
Set Conn = getConnection()
Set Rs   = Server.CreateObject("ADODB.Recordset")
SQLStmn  = "SELECT * FROM TABLE_NAME where Username = "&"'"& request("user")&"'"
     Rs.open SQLStmn, Conn, 1, 3
        If   not(Rs.BOF and Rs.EOF)  Then            
     End if

Author Comment

ID: 8060311
Well i have a logout button and i have created a logout.asp file in which i have the following SQL statment.

Delete from LoginStatus where Username='"+Session("User")"'

I want when the key to be pressed the user to be logged out and also be to be transfered to the logout.asp where it will get the message that he has been logout..

i used the Server.Transfer("logout.asp") command but i does not work properly...

I realy don't have a clue how to do this to work and also to tranfer the user to the logout.asp page

Please help me...Thank you very much

Expert Comment

ID: 8062010
 You used the script right.
I think that maybe something wrong on your script.(not sure  ......asp  or  logout.asp  wrong)
Try again
        build new page : test.asp
--cut old script and  add script
<% Server.Transfer("test.asp") %>    

if no error then something wrong on logout.asp
hope this can help you  :)


Expert Comment

ID: 8201918
i dont know why server.transfer is giving an error to you.

however please verify that the user records are deleted from your database before they are redirected to the logout page.

also, if server.transfer doesnt work, try response.redirect instead.

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
This video teaches users how to migrate an existing Wordpress website to a new domain.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses
Course of the Month8 days, 10 hours left to enroll

765 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