Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP Processing from DB

Status
Not open for further replies.

Gorkem

Programmer
Jun 18, 2002
259
0
0
CA
Hey everyone,

Ok, this to me seems like an impossible task.. This could be because I've been racking my brains on this for way too long..

I am storing some ASP pages into an SQL database for later retrieval. I have one ASP page that calls these stored pages from the SQL server based on "DocumentID". Now this is where I'm stuck. I need to process the text (the stored ASP file) so that the ASP code is actually executed.

I cannot for the life of me figure out how to go about doing this. I want to avoid any writing to the HD if at all possible (which I know is an option, but it will be my dire last option if need be).

Any help would be appreciated!

Cheers,

G.



GT Interactive
-----------------------------
Components/Tools/Forums/Software/Web Services
 
You haven't mentioned which scripting language you are using (VBS or JS)

JS does have the eval(somestring) command which does what you want...can't find the VBS command for that offhand (had a quick look thru a couple of reference books)

Bastien

Any one have a techie job in Toronto, I need to work...being laid off sucks!
 
The usual way should do it:
<%
Set conn=server.createobject(&quot;ADODB.CONNECTION&quot;)
conn.open YourConnectionString
strSql=&quot;SELECT myAspPage From myTable&quot;
set rs=conn.execute(strSql)
If not rs.eof then
myCode=rs(&quot;myAspPage&quot;)
response.write(myCode)
Else
'do something else
End if
set rs=nothing
conn.close
set conn = nothing
%>
That should work providing that:
1. You don't have any declarations (like Option Explicit or @Language=vbscript) at the top of the page that is stored in the database.
2. You don't have additional <% %> tags.
3. You execute the stored procedures using the connection object that is already open (see above). Or name your connection something other than conn (above).
 
Hi Veep,

Thanks for the code.. I had that initially when the files were flat HTML pages.. But I am now storing ASP pages within the database which need to be executed when called.. I know there is the server.execute command, but that only executes ASP code from another physical file and not streamed text.

Cheers,

G.


GT Interactive
-----------------------------
Components/Tools/Forums/Software/Web Services
 
I think your best bet is to stream the data to another page that you create on the fly and then redirect the user to it

Bastien

Any one have a techie job in Toronto, I need to work...being laid off sucks!
 
You're right. I don't know what the heck I was thinking. I guess I have to ask: Why store an .ASP page in a database? If you really had to you could use one page to retrieve the code from the db, then use the file system object to create another .ASP page, and then redirect to it from the initial page. But, what does that get you? Why not just have the page that executes the SP's out there.
 
Hi Guys,

Well that is essentially, I am storing the pages in a database because the pages will be edited online and web based. Using an SQL DB for storing also enables me to do versioning and archiving of any changes, updates and deletions of any &quot;document&quot;.

With that said, I have now gone with my last option which was to create a file on the HD from the streamed text. I am using the Server.Execute() method to call that file and execute the asp code. Seems to work fairly well.. Just concerned about the overhead involved in this type of method.

The system is being used as our Intranet and will be hit quite hard during the day.

Thanks for all your help guys!

G.



GT Interactive
-----------------------------
Components/Tools/Forums/Software/Web Services
 
how about you &quot;export&quot; the document anytime and only when it is updated, to a file that can be hit repeatedly until the next time it needs to be updated. then you just overwrite this &quot;export&quot; when the db is updated.

this way, if the document is only edited once or twice a day, but is hit hundreds of times a day, you do not have the performance loss of needing to stream the document over and over again.

-f!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top