J
joaotsetsemoita
Hi everyone,
This has been been asked before, however before I came here and post
this I really researched a lot and couldn't find a clear answer for my
problem.
Basicaly I need to run code that is stored in the database. More
detailed:
I have a DB table that contains something like this
id code
1 now.day
2 strName
3 monthname(now.month)
and then I have a string like this: "hello #_name#. Today's day is
#_day# and the month is #_month#."
(strName is a variable in my code, lets supose at the time this
function runs will contain the name Jay)
Then I want to string replace what is inside the hash's with the code
in the database in order to get something like
"hello Jay. Today's day is 28 and the month is May"
However what I get when I do the replace is "Hello strName. Today's
day is now.day and the month is monthname(now.month)."
Ofcourse I could just do a Select Case, but the goal is to later on,
add more records to the table to run diferent things, like other
variables or now.month, etc without having to change the code itself
addind more "cases"
I was told to look at something that is called reflection but it
looked a bit complicated for what I'm trying to achive and I have to
say this is my first big .NET project. I've just done small projects
in asp.net and Im not very familiar with .NET at all.
I hope all this makes sense.
Any sugestions, code examples, links to articles, anything that might
help me is higly appreciate.
Thanks in advance
Joao
This has been been asked before, however before I came here and post
this I really researched a lot and couldn't find a clear answer for my
problem.
Basicaly I need to run code that is stored in the database. More
detailed:
I have a DB table that contains something like this
id code
1 now.day
2 strName
3 monthname(now.month)
and then I have a string like this: "hello #_name#. Today's day is
#_day# and the month is #_month#."
(strName is a variable in my code, lets supose at the time this
function runs will contain the name Jay)
Then I want to string replace what is inside the hash's with the code
in the database in order to get something like
"hello Jay. Today's day is 28 and the month is May"
However what I get when I do the replace is "Hello strName. Today's
day is now.day and the month is monthname(now.month)."
Ofcourse I could just do a Select Case, but the goal is to later on,
add more records to the table to run diferent things, like other
variables or now.month, etc without having to change the code itself
addind more "cases"
I was told to look at something that is called reflection but it
looked a bit complicated for what I'm trying to achive and I have to
say this is my first big .NET project. I've just done small projects
in asp.net and Im not very familiar with .NET at all.
I hope all this makes sense.
Any sugestions, code examples, links to articles, anything that might
help me is higly appreciate.
Thanks in advance
Joao