How to read a string value from a table but have it interpreted as a C# custom function?

  • Thread starter Thread starter serge
  • Start date Start date
S

serge

I have a SQL 2000 table with two varchar(50) string columns:
SEARCHCOLUMN VALUECOLUMN
ABC This is an example text
DEF getMyValue("TABLENAME1")


I have some code using SQL DataReader that searches for value "DEF"
and returns "getMyValue("TABLENAME1")"

My problem is how can I return basically
getMyValue("TABLENAME1")
instead of a string text of
"getMyValue("TABLENAME1")"

I am interested to have the function
getMyValue("TABLENAME1")
get executed and return me string value of "5" for example.

getMyValue being another C# function in my code.


Am I explaining properly what I want?

I appreciate your help.

Thank you
 
Piece of cake. All you have to do is write a compiler, compile the code into
an assembly, and then use the assembly to execute the code.

Fortunately, Microsoft has given you a head start. You should start by
reading up on the System.CodeDom and System.CodeDom.Compiler namespaces.

Of course, if you are using a small set of functions in your table, you just
parse the string in VALUECOLUMN, and use a switch statement to decide which
function to call.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
A brute awe as you,
a Metallic hag entity, eat us.
 
Back
Top