Source language: Translate to:

MySQL and Data-Field

Questions about our Advanced Database plug-in

Moderator: Neosoft Support

MySQL and Data-Field

Postby Stefan » Tue Jan 13, 2009 12:52 am

Hi

Have someone experience to put date and time into a date and time-field on a MySQL-Database with NEOBOOKDB-Pro?

I have following code:

DefineVar "[datumorder]" "String" "" "Global" "2009-01-01"
dbpOpenTable "transfer" "orderkopf" ""
dbpAddRecord "transfer" "orderkopf"
SetVar "[transfer.orderkopf.datumorder]" "![datumorder]"
dbpSaveEdits "transfer" "orderkopf"

But i receive everytime the error: '2009-01-01' is not a valid date!
If i put a date directly into the databas by PHP-Tool, it's in the same format: 2009-01-01. Also '01.01.2009' is not correct.

I have also a look to the Refernce of MySQL - so i must have a string and the format can be: 'YYYY-MM-DD' or 'YYYY.MM.DD' or 'YY-MM-DD' and so on.... but no of this format will bring a sucess!

Have someone a solution?
Stefan
 
Posts: 35
Joined: Mon Dec 03, 2007 7:00 am

Postby smartmedia » Tue Jan 13, 2009 1:13 am

Hi...

Try to use this
DefineVar "[datumorder]" "String" "" "Global" "#2009-01-01#"
User avatar
smartmedia
 
Posts: 889
Joined: Fri Apr 01, 2005 6:50 am
Location: Hellas

Postby Stefan » Tue Jan 13, 2009 1:28 am

Hi
No, now i become the error-message: '#2009-01-01#' is not a valid date.
Stefan
 
Posts: 35
Joined: Mon Dec 03, 2007 7:00 am

Postby Gaev » Tue Jan 13, 2009 7:19 am

Stefan:

NeoBook might be doing Math on the number ... 2009 minus 1 minus 1 ... and storing 2007 in [datumorder].

Try ...

DefineVar "[datumorder]" "String" "" "Global" "!2009-01-01"
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby Stefan » Tue Jan 13, 2009 8:51 am

Hi Gaev

Thanks for your tipp!
But i have allready tried this and the errormessage is the same: '2009-01-01' is not a valid date....
Stefan
 
Posts: 35
Joined: Mon Dec 03, 2007 7:00 am

Postby smartmedia » Tue Jan 13, 2009 9:12 am

Hi..

Try to use SetVar instead of DefineVar, maybe that will work. Don't forget as Gaev suggest to enter ! before.
User avatar
smartmedia
 
Posts: 889
Joined: Fri Apr 01, 2005 6:50 am
Location: Hellas

Postby Stefan » Tue Jan 13, 2009 9:18 am

Hi

Also with SetVar "[datumorder]" "!2009-01-01"
i have the same errormessage: '2009-01-01' is not a valid date....

I wonder, because in the MySQL-desription a String-Variable is needed to made an input! Over the web-basesd MySQL-Tool i enter also 2009-01-01.

I have tried so many things....but i have no idea...
Stefan
 
Posts: 35
Joined: Mon Dec 03, 2007 7:00 am

Postby Gaev » Tue Jan 13, 2009 10:13 am

Stefan:

Here ... http://dev.mysql.com/doc/refman/5.1/en/datetime.html ... it says that DATETIME & TIMESTAMP fields are of the form 'YYYY-MM-DD HH:MM:SS'.

Perhaps it is looking for the HH:MM:SS values.
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby Stefan » Tue Jan 13, 2009 11:41 pm

Thanks for your link -but

1. I have declare the type date
and the format for date in the chapter 10.3 says:
Data Type “Zero” Value
DATETIME '0000-00-00 00:00:00'
DATE '0000-00-00'
TIMESTAMP '0000-00-00 00:00:00'
TIME '00:00:00'
YEAR 0000
So, only the datetime and timestamp has this format with the time. The DATE-Format ist only '0000-00-00'

Here the declaration of the field in the MySQL:
datumorder / date / YES / NULL

Yes means, that the field can be NULL and NULL is the standard-Value
Stefan
 
Posts: 35
Joined: Mon Dec 03, 2007 7:00 am

Postby Gaev » Wed Jan 14, 2009 6:29 am

Stefan:
So, only the datetime and timestamp has this format with the time. The DATE-Format ist only '0000-00-00'

Here the declaration of the field in the MySQL:
datumorder / date / YES / NULL
OK ... but in your first post you said ...
Have someone experience to put date and time into a date and time-field on a MySQL-Database with NEOBOOKDB-Pro?


Over the web-basesd MySQL-Tool i enter also 2009-01-01.
Have you tried using the dbpExecSQL method of adding your record ?

Perhaps mySQL was confused by the 1 second adjustment made to clocks at midnight Dec/31 2008 ... and thinks 2009-01-01 is not a real date :? ... have you tried other dates ? ... like 2008-06-07 ?

Seriously though, is there some configuration parameter in mySQL which says that dates will be entered in the format of your "Windows/Linux Date Format" ... and your machine is set up for dd.mm.yyyy ? ... have you tried 01-01-2009 or 01-01-09 ?
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada


Return to NeoBookDBPro

Who is online

Users browsing this forum: No registered users and 1 guest