Results 1 to 3 of 3

Thread: Issues regarding QMySql drivers and mysql database

  1. #1
    Join Date
    Mar 2006
    Posts
    13
    Thanks
    3
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Issues regarding QMySql drivers and mysql database

    Hi,

    I am using QT 3.3 , I would like to know if there are any issues with retrieving values from mysql database. I have been trying to retrieve values in my qt application but it jus doesn work... it returns null value!! My parameters in the query are QDateTime datatypes. but i pass it as a string in the query and compare it against the database. The corresponding coloumn in the database is of datatype(datetime)!!
    The same query works when i query the database directly from console!!
    please help!!

    regards
    Bera

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,013 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Issues regarding QMySql drivers and mysql database

    Can we see the code?

  3. #3
    Join Date
    Aug 2006
    Posts
    12
    Thanks
    1
    Qt products
    Qt3 Qt/Embedded
    Platforms
    Unix/X11

    Smile Re: Issues regarding QMySql drivers and mysql database

    man the thing is you have to pass the Qdate to Qstring and then save it into the DB there is a funtion that allows you to do that and you have to get the format you want and that format has to fix to mysql date format which is yyyy.MM.DD and then save it into the data base, if wanna get it back you just have to do this:

    QSqlQuery Consult("select year(date_field_into_your table) month(date_field_into_your table) day(date_field_into_your table) from your table");
    QString y, m, d;
    while (Consult.next())
    {
    y=Consult.value(0).toString();
    m=Consult.value(1).toString();
    d=Consult.value(2).toString();
    }
    yourDateLineEdit->setDate(y,m,d);

    and that's all that's the way you could get the date back if you have anytrouble insertting the date into the database let me know

Similar Threads

  1. Qt and MySQL Database Connection
    By shamik in forum Qt Programming
    Replies: 41
    Last Post: 6th October 2006, 13:48
  2. MySql plugin driver issues
    By stevey in forum Installation and Deployment
    Replies: 11
    Last Post: 20th September 2006, 14:45

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.