Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Delete records on page load???
Old 03-29-2006, 02:47 PM Delete records on page load???
Average Talker

Posts: 19
Trades: 0
Hello all.

I am using a temp table, and I would like the values in that table containing the users 'UserName' and 'SessionID' to be deleted upon page load, because the following page will insert data into that table with the 'UserName' and a new 'SessionID'. How would I go about doing this?

Thanks,

Parallon
parallon is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-29-2006, 04:29 PM Re: Delete records on page load???
ChipJohns's Avatar
I don't know! Do you?

Posts: 488
Name: Chip Johns
Location: Savannah Georgia
Trades: 0
After your connection string use this sql statement to remove all records in the table.

Code:
DELETE FROM tablename
ChipJohns is offline
Reply With Quote
View Public Profile Visit ChipJohns's homepage!
 
Old 03-30-2006, 04:28 AM Re: Delete records on page load???
Super Talker

Posts: 144
Trades: 0
ack, that code will remove everything. put a WHERE clause in there!

DELETE FROM table WHERE sessionID = 51928
__________________
create.vibe

Please login or register to view this content. Registration is FREE
createvibe.com is offline
Reply With Quote
View Public Profile Visit createvibe.com's homepage!
 
Old 03-30-2006, 04:30 AM Re: Delete records on page load???
Super Talker

Posts: 144
Trades: 0
bwaha, i guess it would help if I slowed down and read everything clearly.

what database are you using?
__________________
create.vibe

Please login or register to view this content. Registration is FREE
createvibe.com is offline
Reply With Quote
View Public Profile Visit createvibe.com's homepage!
 
Old 03-30-2006, 12:13 PM Re: Delete records on page load???
Average Talker

Posts: 19
Trades: 0
Currently I am using Access, but will probably upgrade to SQL once I get this application finished. Also, I am creating most of this application using some of Dreamweaver's built in functions on top of ASP/VBScript, so I am a little confused exactly where to put it. Hope this helps.

Thanks,

Parallon
parallon is offline
Reply With Quote
View Public Profile
 
Old 03-30-2006, 01:39 PM Re: Delete records on page load???
ChipJohns's Avatar
I don't know! Do you?

Posts: 488
Name: Chip Johns
Location: Savannah Georgia
Trades: 0
This is the entire code with the connection and everything. It may or may not work. It depends on your server configuration. This is a pretty generic set up so hopefully it will work.

It should go at the top of the page after your asp declaration statement and before your opening html tag. (If you have another script running for security or session, etc. then it would go after that, but still before you html.)


Code:
<%
Dim oConn, oRS, sQry
Dim sConn

set oConn = Server.CreateObject("ADODB.Connection")
'Relpace Xxxxx with the name of your dsn
sConn = "Data Source=Xxxxx;"
oConn.Open sConn
Set oRS = Server.CreateObject("ADODB.Recordset")
Set oRS.ActiveConnection = oConn

'SQL RecordSet 
'Change tablename to the name of the table in your database
sQry = "DELETE FROM tablename"

oRS.Open sQry

%>
ChipJohns is offline
Reply With Quote
View Public Profile Visit ChipJohns's homepage!
 
Old 03-30-2006, 05:32 PM Re: Delete records on page load???
Average Talker

Posts: 19
Trades: 0
Thank you VERY much. That worked perfectly, although I had a little trouble adding in a variable into the WHERE clause, but I finally got it with:

Code:
 
sQry = "DELETE * FROM Temp_Date WHERE UserName =  '" & SesUserName & "' "
Works like a charm.

Thank you again,

Parallon
parallon is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Delete records on page load???
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.39503 seconds with 12 queries