Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Executing pre-written code from database


Message #1 by "Rick Brose" <brose@u...> on Mon, 26 Mar 2001 17:59:36
I am working on a page that pulls a field from a database where I have 

some code stored to execute. I can get the page to get the value inside 

the database field but I can not get it to run. If I use response.write 

then it just writes out the code from the database. How can I get it to 

run the code.



the database field would contain something like this:



If some value = true and some other value = true then

this value = true and this other value = true end if



this would have actual values to call but I think you can get the picture. 

I need a way to get this from the database and use it as a chunk of ASP 

code instead of just a text value. Is this possible?



-Rick Brose

Message #2 by "Tomm Matthis" <matthis@b...> on Mon, 26 Mar 2001 17:10:27 -0500
Look into using the EVAL statement in VBScript.....



Tomm



> -----Original Message-----

> From: Rick Brose [mailto:brose@u...]

> Sent: Monday, March 26, 2001 6:00 PM

> To: ASP Databases

> Subject: [asp_databases] Executing pre-written code from database

>

>

> I am working on a page that pulls a field from a database where I have 



> some code stored to execute. I can get the page to get the value 

inside

> the database field but I can not get it to run. If I use 

response.write

> then it just writes out the code from the database. How can I get it 

to

> run the code.

>

> the database field would contain something like this:

>

> If some value =3D true and some other value =3D true then

> this value =3D true and this other value =3D true end if

>

> this would have actual values to call but I think you can get the

> picture.

> I need a way to get this from the database and use it as a chunk of 

ASP

> code instead of just a text value. Is this possible?

>

> -Rick Brose

>



Message #3 by "Dallas Martin" <dmartin@z...> on Mon, 26 Mar 2001 18:37:27 -0500
Assuming the code in question is to be executed on the IIS server, I know of

one way:



You will use the FileScripting Object and a TEMPLATE page:



The TEMPLATE page contains a phrase such as this:



CODE_TO_BE_REPLACED



First get your code from the database,

Open the template file using FSO,

read in the entire file,

use the replace() function: BigFile 

replace(bigfile,"CODE_TO_BE_REPLACED",NEWCODE)

write out the replace string to a target file, "newfile.asp"

Response.redirect("newfile.asp") to execute the new page.



Dallas









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

From: "Rick Brose" <brose@u...>

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

Sent: Monday, March 26, 2001 5:59 PM

Subject: [asp_databases] Executing pre-written code from database





> I am working on a page that pulls a field from a database where I have

> some code stored to execute. I can get the page to get the value inside

> the database field but I can not get it to run. If I use response.write

> then it just writes out the code from the database. How can I get it to

> run the code.

>

> the database field would contain something like this:

>

> If some value = true and some other value = true then

> this value = true and this other value = true end if

>

> this would have actual values to call but I think you can get the picture.

> I need a way to get this from the database and use it as a chunk of ASP

> code instead of just a text value. Is this possible?

>

> -Rick Brose



Message #4 by "Rick Brose" <brose@u...> on Tue, 27 Mar 2001 18:33:09
Thanks for the help. The eval() function wasn't what I was looking for but 

it did lead me to the execute() function within VB. That works like a 

charm. I appreciate the help.



-Rick

  Return to Index