p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

asp_databases thread: Saving/Passing Information


Message #1 by Leo Clayton <claytonl@z...> on Fri, 01 Dec 2000 15:28:33 -0500
I want to delete a record from a table (which I can do successfully) and 

save the record ID number so that I can go to another table, in another 

page,  and delete ALL of the records in that table that have the same ID 

number.



I was going to do it by saving the ID number in a Session variable, but 

have been told that is a bad technique/practice.  So can someone tell me 

how I am going to accomplish this so that I can access the information I 

need on the next/another page?



Message #2 by Imar Spaanjaars <Imar@S...> on Sat, 02 Dec 2000 13:43:21 +0100
Using session variables is not necessarily a bad thing. It depends on the 

type of application your are creating. If you read previous posts on the 

WROX lists, you'll find that most people try to avoid using session 

variables in an Internet application that needs to be able to grow / scale.

However, for smaller intranet- or admin-applications, session variables can 

be used without degrading the performance of the system (too much).



But, suppose you want to avoid them altogether, you could append the ID to 

the QueryString and then read it in the next page:



' Delete FROM database where ID = " & ID

Response.Redirect("theSecondPage.asp?ID=" & ID)



Then in the second page, you can do this:



Dim iID

iID = Request.QueryString("ID")

' DELETE FROM Another table WHERE ID = " & iID etc etc



However, why do you want to post it to another page?? Why not delete them 

all in the same page? There is nothing against performing multiple database 

actions in one page. You could easily re-use your current connection / 

command / recordset objects and perform multiple actions against them. This 

would definitely perform better.



HtH





Imar





At 03:28 PM 12/1/2000 -0500, you wrote:

>I want to delete a record from a table (which I can do successfully) and 

>save the record ID number so that I can go to another table, in another 

>page,  and delete ALL of the records in that table that have the same ID 

>number.

>

>I was going to do it by saving the ID number in a Session variable, but 

>have been told that is a bad technique/practice.  So can someone tell me 

>how I am going to accomplish this so that I can access the information I 

>need on the next/another page?

>

>





Message #3 by "Pat Waddington" <paw@s...> on Sun, 3 Dec 2000 14:00:59 -0000
Pass the record number in a QueryString



HTH

----- Original Message -----

From: "Leo Clayton" <claytonl@z...>

To: "ASP Databases" <asp_databases@p...>

Sent: Friday, December 01, 2000 8:28 PM

Subject: [asp_databases] Saving/Passing Information





> I want to delete a record from a table (which I can do successfully) and

> save the record ID number so that I can go to another table, in another

> page,  and delete ALL of the records in that table that have the same ID

> number.

>

> I was going to do it by saving the ID number in a Session variable, but

> have been told that is a bad technique/practice.  So can someone tell me

> how I am going to accomplish this so that I can access the information I

> need on the next/another page?

>

Message #4 by "Harsh Nandu" <harsh_stgil@h...> on Mon, 04 Dec 2000 06:41:07 -0000
Better approach would be to write a stored procedure or a trigger for the 

same if no other intracacies are involved.





>From: Imar Spaanjaars <Imar@S...>

>Reply-To: "ASP Databases" <asp_databases@p...>

>To: "ASP Databases" <asp_databases@p...>

>Subject: [asp_databases] Re: Saving/Passing Information

>Date: Sat, 02 Dec 2000 13:43:21 +0100

>

>Using session variables is not necessarily a bad thing. It depends on the

>type of application your are creating. If you read previous posts on the

>WROX lists, you'll find that most people try to avoid using session

>variables in an Internet application that needs to be able to grow / scale.

>However, for smaller intranet- or admin-applications, session variables can

>be used without degrading the performance of the system (too much).

>

>But, suppose you want to avoid them altogether, you could append the ID to

>the QueryString and then read it in the next page:

>

>' Delete FROM database where ID = " & ID

>Response.Redirect("theSecondPage.asp?ID=" & ID)

>

>Then in the second page, you can do this:

>

>Dim iID

>iID = Request.QueryString("ID")

>' DELETE FROM Another table WHERE ID = " & iID etc etc

>

>However, why do you want to post it to another page?? Why not delete them

>all in the same page? There is nothing against performing multiple database

>actions in one page. You could easily re-use your current connection /

>command / recordset objects and perform multiple actions against them. This

>would definitely perform better.

>

>HtH

>

>

>Imar

>

>

>At 03:28 PM 12/1/2000 -0500, you wrote:

>>I want to delete a record from a table (which I can do successfully) and

>>save the record ID number so that I can go to another table, in another

>>page,  and delete ALL of the records in that table that have the same ID

>>number.

>>

>>I was going to do it by saving the ID number in a Session variable, but

>>have been told that is a bad technique/practice.  So can someone tell me

>>how I am going to accomplish this so that I can access the information I

>>need on the next/another page?

>>

>>

>

>

>

Message #5 by "Kart" <karthik1@h...> on Mon, 4 Dec 2000 12:28:29 +0530
Hi Leo,



You could pass the ID using input type - hidden in HTML. And request the

imput element in the next page; if you dont want it to be visible in the

query string.



If the second page doesnt do mch of anything, why not use a trigger to

cascade delete all the related records in other tables.



Kart

----- Original Message -----

From: Leo Clayton <claytonl@z...>

To: ASP Databases <asp_databases@p...>

Sent: Saturday, December 02, 2000 1:58 AM

Subject: [asp_databases] Saving/Passing Information





> I want to delete a record from a table (which I can do successfully) and

> save the record ID number so that I can go to another table, in another

> page,  and delete ALL of the records in that table that have the same ID

> number.

>

> I was going to do it by saving the ID number in a Session variable, but

> have been told that is a bad technique/practice.  So can someone tell me

> how I am going to accomplish this so that I can access the information I

> need on the next/another page?

>

>

Message #6 by "jigs gandhi" <newsgroup@h...> on Tue, 5 Dec 2000 10:17:39 +0530
This is a multi-part message in MIME format.



------=_NextPart_000_0578_01C05EA4.98D642C0

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable



hi,





the good practice is that first you retrive the recordids which you want 

to delete. store it in variables (not session, page level)

first delete all CHILD records and then goto delete the master record.

also do all this things in a "single transaction"

  ----- Original Message -----

  From: Leo Clayton

  To: ASP Databases

  Sent: Saturday, December 02, 2000 1:58 AM

  Subject: [asp_databases] Saving/Passing Information





  I want to delete a record from a table (which I can do successfully) 

and

  save the record ID number so that I can go to another table, in 

another

  page,  and delete ALL of the records in that table that have the same 

ID

  number.



  I was going to do it by saving the ID number in a Session variable, 

but

  have been told that is a bad technique/practice.  So can someone tell 

me

  how I am going to accomplish this so that I can access the information 

I

  need on the next/another page?





  ---

  FREE SOFTWARE DEVELOPMENT CODE, CONTENT, AND

  INSIGHTS IN YOUR INBOX!

  Get the latest and best C++, Visual C++, Java, Visual Basic, and XML 

tips, tools, and

  developments from the experts.  Sign up for one or more of EarthWeb?s

  FREE IT newsletters at http://www.earthweb.com today! 




$subst('Email.Unsub')










Message #7 by Imar Spaanjaars <Imar@S...> on Sat, 02 Dec 2000 13:43:21 +0100
Using session variables is not necessarily a bad thing. It depends on the 

type of application your are creating. If you read previous posts on the 

WROX lists, you'll find that most people try to avoid using session 

variables in an Internet application that needs to be able to grow / scale.

However, for smaller intranet- or admin-applications, session variables can 

be used without degrading the performance of the system (too much).



But, suppose you want to avoid them altogether, you could append the ID to 

the QueryString and then read it in the next page:



' Delete FROM database where ID = " & ID

Response.Redirect("theSecondPage.asp?ID=" & ID)



Then in the second page, you can do this:



Dim iID

iID = Request.QueryString("ID")

' DELETE FROM Another table WHERE ID = " & iID etc etc



However, why do you want to post it to another page?? Why not delete them 

all in the same page? There is nothing against performing multiple database 

actions in one page. You could easily re-use your current connection / 

command / recordset objects and perform multiple actions against them. This 

would definitely perform better.



HtH





Imar





At 03:28 PM 12/1/2000 -0500, you wrote:

>I want to delete a record from a table (which I can do successfully) and 

>save the record ID number so that I can go to another table, in another 

>page,  and delete ALL of the records in that table that have the same ID 

>number.

>

>I was going to do it by saving the ID number in a Session variable, but 

>have been told that is a bad technique/practice.  So can someone tell me 

>how I am going to accomplish this so that I can access the information I 

>need on the next/another page?

>

>







---

FREE WEB DEVELOPMENT CODE, CONTENT, AND INSIGHTS

IN YOUR INBOX!

Get the latest and best HTML, XML, and JavaScript tips, tools, and 

developments from the experts.  Sign up for one or more of EarthWeb's

FREE IT newsletters at http://www.earthweb.com today!  







  Return to Index