473,322 Members | 1,259 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Hi,can any one please help me for deleting data after closing the site

Hi EveryOne,
I am having problem with deleting data form database after anyone have close the site. or any one have click the cancel button after entering data. I know the code for deleting data from a MS Access database, But I don,t know waht code to write in thease cases.

Nazia
May 21 '07 #1
5 1476
jhardman
3,406 Expert 2GB
Nazia,

The trick is to let the server know when someone leaves the site, which doesn't normally happen. I guess you can use javascript to open a window when someone leaves. Another option is that next time someone logs in, the script checks to see if anyone left some data that should have been deleted. If the second option wouold work, it would be the best option since some browsers might interpret the new window as an undesired pop-up and block it.

Jared
May 21 '07 #2
Nazia,

The trick is to let the server know when someone leaves the site, which doesn't normally happen. I guess you can use javascript to open a window when someone leaves. Another option is that next time someone logs in, the script checks to see if anyone left some data that should have been deleted. If the second option wouold work, it would be the best option since some browsers might interpret the new window as an undesired pop-up and block it.

Jared
Thank you Jared
But the problem is as it is a demo ecommerce site there is no loogin system. And what you are suggesing can you give me some code on that .

Nazia
May 23 '07 #3
jhardman
3,406 Expert 2GB
Thank you Jared
But the problem is as it is a demo ecommerce site there is no loogin system. And what you are suggesing can you give me some code on that .

Nazia
Sure, give me some idea what info you are saving that you need to delete after the guest leaves.

Jared
May 24 '07 #4
Sure, give me some idea what info you are saving that you need to delete after the guest leaves.

Jared
Thank You Jared,
What I want do is the customers are selecting some products, all the products are like monitor, Laptops and so on.and after the request it is saving to the database. For each page of products there is a new database. Whenever a customer want to select a product from that page and select and click the sumit button it automaticly go to the database regarding to it and clear all the previous information. There is a problem that if anyone tries to buy the thing two times from the same page only the recent one will be available to the database.
And the major proble arises when a person selecting only from one page the the item of other pages stoed in the databse by the previous person added to the cart.


So what i want do is to save them to the same table in the database.And whwnever any one will buy the products by clicking the buy button everything will be deleted from the database. this far I can do. But what to do if the person does not buy and all the item selected are saved in the database.so these are the data I want to delete whenever a new person come or a person leave from the site.

Nazia
May 26 '07 #5
jhardman
3,406 Expert 2GB
Nazia,

I really like using session-level variables for this type of thing. Try it like this
Expand|Select|Wrap|Line Numbers
  1. if session("user") = "" then
  2.    'this is a new user, so clear out the saved db entry
  3.    session("user") = "user" 'this could be a login name or whatever.
  4. end if
  5.  
This would work fine. As long as the person doesn't stay idle for 25 minutes (I'm not sure what the default session time-out is) the db stays good, but if a new person logs in the previous db entry is deleted.

The problem with this method is that if there were two users at the same time they would be cancelling each other's orders.

I think it would work a little better if you stored the selected items in session-level variables:
Expand|Select|Wrap|Line Numbers
  1. for each x in request.form
  2.    session(x) = session(x) & request.form(x)
  3. next
  4.  
then every time the form is filled out the info is saved in variables that only that user can access. Then you don't have to worry about clearing the db when the user leaves at all because the data is saved temporarily.

Does this make sense?

Jared
May 28 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: kris.dorey | last post by:
Hi, Ive got the following code which seems ok but when the user runs the function for a second time I get an error message stating that the mdb is in use by another process. There is still an...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
5
by: Dylan Parry | last post by:
Hi, I'm trying to upload some files via a form, and I have managed so far to save the files on the server in a temporary directory using: HttpPostedFile.SaveAs(string filename); This is a...
9
by: TF | last post by:
Hello all, I made a ASP.NET 2.0 site that shows possible "recipes" for paint colors stored in an access dbase. Basically, 1000 colors are stored with specific RGB values in separate columns. A...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.