SunQuest
           ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old July 30th, 2003, 11:20 AM
s_haslam s_haslam is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Utah
Posts: 4 s_haslam User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to s_haslam Send a message via Yahoo to s_haslam
Execute asp command from a String

I am trying to make our website a bit more dynamic. one of the ways i want to do this is to be able to put in ASP code into our MySQL database (the code would be different for every company) and have it execute when the page is brought up.

We have the potential of having thousands of companies using our website, so having it hard coded will be hard to maintain, and having it save to a file will become cumbersome if there are too many users.

Anyone have any ideas on how to execute a piece of ASP code straight from a string varaible?

Thank you for your input

Steven Haslam
ContactPoint
Information Technology
URL

Reply With Quote
  #2  
Old July 30th, 2003, 12:36 PM
Vlince Vlince is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Canada, Quebec, Montreal
Posts: 410 Vlince User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Personally, I wouldn't put asp code into your MySQL database.

Instead, I'd create an #include file that holds a Sub...End Sub or Function...End Function.

Either one of them should have a parameter like the CompanyId for example.

Then the code inside the Sub/Function is executed based on the CompanyId.

Assuming your store some asp code into your MySQL database, then you get a recordset that holds the code. What next?
Do you put it inside a variable?
Something like:

<%
. . .
. .
.
strCodeToExecute = objRst("Code")

%>

But then what?

You'd like to have some sort of eval() like in javascript?

Never seen this work, actually don't even know if it can be done(plus I'm coming back from a big lunch so I can't think straight...)

that's why I suggest the include file approach.

Hope this helps!
Sincerely

Vlince

Reply With Quote
  #3  
Old July 30th, 2003, 12:43 PM
s_haslam s_haslam is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Utah
Posts: 4 s_haslam User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to s_haslam Send a message via Yahoo to s_haslam
The problem with that is that i want to be able to manage these things right from the website, not have to get into the hard code each and every time a new company is setup. i would rather go into the company settings, and if coding is needed, i would like to edit right there in a text box.

I believe i have found my solution by just playing around with the code. there is an Execute() statement that takes a string and runs it.

stringa = "response.write 1"
Execute(stringa)

and it outputs 1 on the page.

i will have to see how it does with some larger commands, but i think it looks hopefull.

Reply With Quote
  #4  
Old July 30th, 2003, 12:44 PM
sdssssss sdssssss is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 1 sdssssss User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
hemm

If you really want it in your database, an idea is that mayb you could turn your asp code into hexidecimal form, because that will store real easy, no problems with what you want in the asp code then.

instead of <% response.write "@#(@)#(@#)" %>
it would be AH4DH3D5S6A7F8K9J3D2L2F2A2K54F

Reply With Quote
  #5  
Old July 30th, 2003, 12:45 PM
s_haslam s_haslam is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Utah
Posts: 4 s_haslam User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to s_haslam Send a message via Yahoo to s_haslam
Re: hemm

Quote:
Originally posted by sdssssss
If you really want it in your database, an idea is that mayb you could turn your asp code into hexidecimal form, because that will store real easy, no problems with what you want in the asp code then.

instead of <% response.write "@#(@)#(@#)" %>
it would be AH4DH3D5S6A7F8K9J3D2L2F2A2K54F



um... is this forum a joke? i thought it was php-bias'd... but i guess its much more then that...

Reply With Quote
  #6  
Old July 30th, 2003, 12:58 PM
s_haslam s_haslam is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Utah
Posts: 4 s_haslam User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to s_haslam Send a message via Yahoo to s_haslam
Quote:
Originally posted by s_haslam
The problem with that is that i want to be able to manage these things right from the website, not have to get into the hard code each and every time a new company is setup. i would rather go into the company settings, and if coding is needed, i would like to edit right there in a text box.

I believe i have found my solution by just playing around with the code. there is an Execute() statement that takes a string and runs it.

stringa = "response.write 1"
Execute(stringa)

and it outputs 1 on the page.

i will have to see how it does with some larger commands, but i think it looks hopefull.


Ah, it works with larger commands too.


Quote:
You'd like to have some sort of eval() like in javascript?

Never seen this work


well, Execute() must be a sort of eval().

Thanks

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Execute asp command from a String


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway