Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Datetime to SQL SERVER
Message
From
05/01/2009 15:03:15
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01371088
Message ID:
01371153
Views:
27
>Hi.
>I am trying to popuate a sql server table Data time field from a foxpro table
>I have set Set date British or Set Date american before creating the fields
>(Some are string fields and some are character fields)
> I want to populate
>This all works fine on my PC but when I deploy to client's site,
> the datas are all mixed up (getting the Days/Months wrong)
>
>Is there something else I need to check
>I am using TTOC(DTOT(MyDate))
>Regards,
>Gerard

Solution is simple, do not use ttoc() :)
Are you using SQLExec? If so then assuming your date field's name is orderDate:
text to m.lcSQL noshow
insert into myTable 
   (charField, dateField) 
   values 
   (?myVFPTable.field1, ?myVFPTable.orderDate)
endtext


select myVFPTable
SQLPrepare(m.handle, m.lcSQL)
scan
 SQLExec(m.handle)
endscan
The important part in this sample is that, the data you pass is not hardcoded in sql string but parametric. There are of course N ways to transfer (insert/update/delete/select) data to/from SQL server and other ways even doesn't need this parameterization (automatically done by VFP).
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