>>Kind of along the same lines, I was trying to setup an environment for SQLSetProp(), using a table to manage the style of connection I need. What would you recommend for setting a variables type based on another column name?
>>
>>My table looks something like this:
>>
>> cPropName cPropType cPropVal
>> 'Asynchronous' l .f.
>> 'Comment' c ''
>> 'ConnectTimeOut' n 15
>>
>>
>>I figure'd I would scan through the table, and do SQLSetProp with each cPropValue:
>>
>> SQLSetProp(nConnHandle,cPropName,cPropVal)
>>
>>
>>But since the cPropVal column is a char type, and my back end is expecting char/num/logical, things choke. I thought I'd make a little do case thing with transform() and cPropType but nothing is coming together.
>>
>>What do you think?
>
>Since you have the data type, you could use a SELECT CASE statement to examine the individual data types and set a the type variable accordingly. For example, VAL() for numerics, EVALUATE() for Booleans, etc.
Evaluate for them all - they'll just turn out into their proper data type. Type('eval(".f.")') gives you a "L", and Ttype('eval("1")') gives you a "N"; therefore Eval(".f.") does give you a real Boolean .f. and no problems.