Results 1 to 6 of 6

Thread: Problem to insert 01.01.9999 to date column

  1. #1
    Join Date
    Mar 2008
    Posts
    55
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Problem to insert 01.01.9999 to date column

    Hello everyone,
    I've an application which inserts records into a Firebird database. But when I want to insert the value "01.01.9999" to a Date column, this date is returned invalid by Qt and I won't retreive the record in my database.
    Does anyone have an idea about this problem and can help me to resolve it.
    Best regards

  2. #2
    Join Date
    Oct 2011
    Location
    CHINA
    Posts
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem to insert 01.01.9999 to date column

    maximumDate : QDate

    This property holds the maximum date of the date time edit.

    When setting this property the minimumDate is adjusted if necessary to ensure that the range remains valid. If the date is not a valid QDate object, this function does nothing.

    By default, this property contains a date that refers to December 31, 7999.

    Does this help?

  3. #3
    Join Date
    Mar 2008
    Posts
    55
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Problem to insert 01.01.9999 to date column

    Thank you for your quick response. I've searched how to change the range date but I've not found where.
    Can you tell me how to do ? I'm usign Qt 4.3
    Best regards.

  4. #4
    Join Date
    Oct 2011
    Location
    CHINA
    Posts
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem to insert 01.01.9999 to date column

    QDateTimeEdit :: void setMaximumDate ( const QDate & max )
    This will do what you want

  5. #5
    Join Date
    Mar 2008
    Posts
    55
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Problem to insert 01.01.9999 to date column

    Thanks for your help but I've a console application. I can't use QDateTimeEdit.

  6. #6
    Join Date
    Jul 2010
    Location
    Fortaleza, Brazil
    Posts
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Problem to insert 01.01.9999 to date column

    Well, maybe you are doing something wrong.
    Try to do something like this:

    QSqlQuery qry;
    QDateTime date = QDateTime::currentDateTime();

    if (!qry.prepare("UPDATE user SET last_login = :last_login;")) {
    qWarning() << qry.lastError();
    }
    qry.bindValue(":last_login", date);
    if (!qry.exec()) {
    qWarning() << qry.lastError();
    }

Similar Threads

  1. Qtableview insert row and column
    By maarvi in forum Newbie
    Replies: 1
    Last Post: 1st July 2011, 09:26
  2. Replies: 1
    Last Post: 12th April 2011, 23:43
  3. how coult this happen with the QTableView Column insert?
    By xiongxiongchuan in forum Qt Programming
    Replies: 6
    Last Post: 13th December 2010, 06:32
  4. Replies: 2
    Last Post: 13th April 2010, 16:50
  5. Insert into array column
    By wirasto in forum Newbie
    Replies: 3
    Last Post: 9th November 2009, 15:07

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.