Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Insert A DateTime
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01244288
Message ID:
01244293
Views:
24
You still need to transform sDateTime to a real datetime

Depending on how you have it in the list, this might work or not

sCommand = "INSERT INTO TestData (Caption, DateTime1) VALUES ('dd', ctot(sDateTime))"


>I'm still having trouble. I have a DateTime stored as a string in a list.
>I want to insert it into a DATETIME column:
>
>
>CLEAR
>CLOSE DATABASES all
>USE TestData
>
>sDateTime = .lstInfo.List(.lstInfo.ListIndex, 4)
>
>sCommand = "INSERT INTO TestData (Caption, DateTime1) VALUES ('dd', sDateTime)"
>&sCommand
>
>RETURN
>
>
>I get a Data Type Mismatch
>
>
>
>>>Thanks
>>>
>>>
>>
>>You are welcome, but... I Forgot to mention that CTOT might create ambiguous dates so the recommendation is to use DateTime(nYear, nMonth, nDay, nHour, nMinutes, nSeconds)
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform