Run stored code in database in runtime mode

Hi,
Is there any possibility to store code blocks  in a Database and then run  them in run-time mode ? Something like short codes in wordpress.

for ex.

if a = 0 then
   run func1
else
   run func2
endif



' Stored code
func1(byval myvar as integer) as integer
   
   
    return myvar/100

end sub
rflorencioAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David Johnson, CD, MVPOwnerCommented:
if you are referring to running commands on the sql server it is called aptly 'stored procedure'
0
rflorencioAuthor Commented:
Hi,

No i need call vb.net functions (run vb.net commands) in runtime mode, but not inside my code. Call when i need but vb.net is called from a table in a database. Not sql.

best regards
0
David Johnson, CD, MVPOwnerCommented:
.net programs are compiled at runtime or before and not interpreted.. calling code from an external source would need interpreted language like php/html/basic/lisp etc.
0
käµfm³d 👽Commented:
While I agree that .NET code cannot be interpreted, you can actually compile code on the fly. I wrote an example some time back.

While you can do this if you like, I will forewarn you that this is very risky and potentially dangerous in a production environment.  It may be safer to write keys into the database instead. Those keys would be used by your .NET code to look up a function that you've already written in the code. You could use a dictionary of delegates or maybe a switch statement to do the lookups.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.