I have to create a mathematical expression with column object as operands and validate the datatype of the operands. The column object represents a database column and consists of table name, column name and datatype. If the operand datatype is text or bool an error message should be displayed. How can this validation be done?

((column1 + column2)/column3) is an expression that i need to validate.column1,column2 & column3 are 3 column objects(c# objects) and it stores the datatype as string.i need to compare the data types using the column object.
–
user673453Mar 23 '11 at 17:06

When you say "is an expression" does that mean you have a string value equaling "((column1 + column2)/column3)"? Then your problem is about parsing that text into an abstract syntax tree, or at least tokenizing the text into token sequence. Once you have that, you can walk the AST or tokens to match them up with your column objects, check the datatype and react accordingly.
–
Jim BollaMar 23 '11 at 17:19