>I would like to pass a value from a temp file to SQL server field. The type of field could be a memo field or a date field. To get the value into SQL server it needs to a string. Therefore I need to test what the field type is first.
>
>Therefore I would like to find whether the field is a date or a memo based on this I will either DTOS the field or use a function for converting a memo field into a date field.
>
>IIF(planning.date=A MEMO FIELD TYPE, whatever function, DTOS(planning.date)
>
>I just need to find out what type of field it is then either convert the date to string or the memo to string. Is this possible?
Neil,
You don't need to convert, VFP converts for you. ie:
myDate = date()
myOtherDatetime = myTemp.DatetimeField
* Instead of ?m.myOtherDatetime might use ?myTemp.DatetimeField
myNumber = 100
myMemo = myTable.myMemo
* Instead of ?m.MyMemo could use ?myTable.myMemo
* but passing is not same and might drop characters -MSSQL bug
SQLExec(handle, "insert into MSSQLTable (f1,f2,f3,f4) values"+;
"(?m.myDate,?m.myOtherDateTime,?m.MyNumber,?m.myMemo)")
You could of course check the type with type() or vartype() and convert with say transform() if you still want to.
Cetin