Results 1 to 5 of 5

Thread: QSql error

  1. #1
    Join Date
    Jan 2006
    Posts
    4
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Smile QSql error

    how can we take the error number . i am using postgresql
    i user the methode
    int QSqlError::number () const
    but it always return -1
    y?
    pls any body help me

  2. #2
    Join Date
    Jan 2006
    Location
    Kerala
    Posts
    371
    Thanks
    76
    Thanked 37 Times in 32 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QSql error

    Hi,

    When you execute a query using QSqlQuery, and it generates an error, Then you can use the QSqlQuery::lastError() to get the QSqlError, Now if the number() returns -1, it just means that there wasn't any error.
    We can't solve problems by using the same kind of thinking we used when we created them

  3. #3
    Join Date
    Feb 2006
    Posts
    157
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4

    Default Re: QSql error

    cann't you use ..

    Qt Code:
    1. int QSqlError::type () const
    To copy to clipboard, switch view to plain text mode 

    then check it..
    Qt Code:
    1. if( type() == QSqlError::None ) //if no error
    2. else if type() == QSqlError::Connection ) // if connection error
    To copy to clipboard, switch view to plain text mode 
    ----etc

    or Try the lastError() as sunil said.
    Last edited by wysota; 20th December 2006 at 10:15. Reason: changed [html] to [code]

  4. #4
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: QSql error

    For more usability use QSqlError::showMessage()
    a life without programming is like an empty bottle

  5. #5
    Join Date
    Feb 2006
    Posts
    157
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4

    Default Re: QSql error

    mammmuuuu....

    Did you get the solution..???

    If you got the solution just post it in the forum so that others can use it.

Similar Threads

  1. Qt-x11-commercial-src-4.2.0-snapshot-20060824 error
    By DevObject in forum Installation and Deployment
    Replies: 4
    Last Post: 24th August 2006, 23:31
  2. use qpsql
    By raphaelf in forum Installation and Deployment
    Replies: 34
    Last Post: 22nd August 2006, 12:52
  3. Problems
    By euthymos in forum Installation and Deployment
    Replies: 2
    Last Post: 13th June 2006, 19:11
  4. Fed up with M$ Window$ !!! Why is Tux leaving me alone???
    By fullmetalcoder in forum General Discussion
    Replies: 35
    Last Post: 18th March 2006, 12:57
  5. Am I the only one with "make" error ?
    By probine in forum Installation and Deployment
    Replies: 1
    Last Post: 13th February 2006, 12:54

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.