Re: inserting a date variable into a foxpro db

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi Theo,

Your code fragment is a little too small to see what's going on. Be sure
you're sending a Date data type and not characters or a DateTime data type.
Also, in SQL Pass-through the way to represent a Date in a text string is to
surround it with curly brackets. There is an ordinary date such as
{06/17/2003}, but the day an month can be confused depending on your Windows
date settings. To be sure you've got a strict representation of the date use
curly brackets and a caret: {^2005/06/17}. Also, you can represent a date
with the FoxPro Date() function. Date() is today and Date(2005, 6, 18) is
tomorrow. Finally, there is a CtoD() function (Character To Date) which
looks like CtoD("06/17/2005"). This can be problematic for determining the
day and month. One more thing, Fox accepts single and double quotes, and
also square brackets as string delimiters. This is especially useful in SPT
when one of your values is a character string.

Here's some code examples:

strSQL = "Insert Into MyDateField Values ({^2005/06/18})"
strSQL = "Insert Into MyDateField Values (Date(2005, 6, 18))"
strSQL = "Insert Into MyDateField Values (CtoD([06/18/2005]))"

--
Cindy Winegarden MCSD, Microsoft Visual Foxpro MVP
cindy_winegarden@xxxxxxx www.cindywinegarden.com
Blog: http://spaces.msn.com/members/cindywinegarden


"Theo" <theo@xxxxxxxxxxxxxx> wrote in message
news:598565574839795@xxxxxxxxxxxxxxxxxxxxx
> When inserting a new record I always seem to get a data type mismatch.
>
> Part of the code is
> ''"&request.form("inspectiontime")&"''
>
> my VFP field is a date..


.



Relevant Pages

  • Re: Help Extracting Numbers formula
    ... way to tell that they're numeric numbers (data type: ... Microsoft Excel MVP ... find formula to pull out a number from a text string, ... starting from the leftmost character. ...
    (microsoft.public.excel.misc)
  • Re: how to use pb load fortrans dll?
    ... same data type is character,when i excute it,it all always report ... runtime in dll function fuel_airpath(invalid stack pointer on return ... SUBROUTINE fuel_airpath(ref real s,ref string p)library ... character variable plus a hidden argument which contains the actual ...
    (comp.lang.fortran)
  • Re: Which is better - a char type or a string of length one?
    ... data type but its strings have a terminating zero so C has to ... string of one character needs at least two cells. ... If you just specify a string type, you would need runtime checks to ...
    (comp.lang.misc)
  • Code with Character
    ... Code with Character ... The String type is a little harder to read. ... String can be a reliable data type. ... It wasn't until this Object data type rolled into town that I really ...
    (comp.software.testing)
  • Code with Character
    ... Code with Character ... The String type is a little harder to read. ... String can be a reliable data type. ... It wasn't until this Object data type rolled into town that I really ...
    (comp.sys.hp.mpe)