Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Testing a Field Type
Message
From
24/09/2004 07:28:48
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00945673
Message ID:
00945679
Views:
17
>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
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform