Results 1 to 3 of 3

Thread: Access to PostgresSql DB

  1. #1
    Join Date
    May 2014
    Posts
    7
    Qt products
    Qt5
    Platforms
    Windows

    Default Access to PostgresSql DB

    Hello

    I have a question to ask hoping someone can help me ....

    I access from my application to a Postgres database. I have to make a call to a function with parameters on the DB that returns two cursors and then display the data in a tableView. I will return errors and I wonder if QT with a call of this type is supported.
    This is mycode:

    Qt Code:
    1. QSqlQuery qdb1(db);
    2.  
    3. int iSr=0;
    4. QString stGeom,stImage,stVideo,stDateFrom,stDateTo;
    5.  
    6. iSr= ui->comboBoxSr->currentIndex();
    7. stGeom="";
    8. stImage="";
    9. stVideo="";
    10. stDateFrom="";
    11. stDateTo="";
    12.  
    13. // c1 and c2 are dbcursor
    14. qdb1.prepare("select * from f_get_data('c1', 'c2', ?, ?, ?, ?, ?, ?);fetch all in c1;fetch all in c2;");
    15.  
    16.  
    17. qdb1.bindValue(0, iSr);
    18. qdb1.bindValue(1, stGeom);
    19. qdb1.bindValue(2, stImage);
    20. qdb1.bindValue(3, stVideo);
    21. qdb1.bindValue(4, stDateFrom);
    22. qdb1.bindValue(5, stDateTo);
    23.  
    24.  
    25. qdb1.setForwardOnly(true);
    26. if(qdb1.exec()){
    27. model1->setQuery(qdb1);
    28.  
    29. ui->tableViewMissionPlan->setModel(model1);
    30. ui->tableViewMissionPlan->show();
    31.  
    32. }
    To copy to clipboard, switch view to plain text mode 

    Thank's a lot

  2. #2
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,540
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Access to PostgresSql DB

    What error ?

  3. #3
    Join Date
    May 2014
    Posts
    7
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Access to PostgresSql DB

    Hi

    The error is a alert from Microsoft Visual C++ Debug Library

    Qt Code:
    1. "debug assertion failed!
    2.  
    3. File f:\dd\vctools\crt_bld\self_x86\crt\src\dbgheap.c
    4. line 1322
    5.  
    6.  
    7. expression:_CrtIsValidHapPointer(pUserData)"
    To copy to clipboard, switch view to plain text mode 



    Thank's
    Last edited by synpro85; 27th May 2014 at 09:19.

Similar Threads

  1. Access USB from Qt???
    By webquinty in forum Qt Programming
    Replies: 5
    Last Post: 6th June 2011, 08:40
  2. Qt Creator Can not access network using QT 4.7.2
    By jayesh_shah in forum Qt Tools
    Replies: 2
    Last Post: 12th April 2011, 05:36
  3. postgresSQL compiled but canot be used
    By szisziszilvi in forum Qt Programming
    Replies: 6
    Last Post: 30th March 2011, 10:06
  4. Can't access dll
    By waynew in forum Newbie
    Replies: 4
    Last Post: 15th November 2010, 13:06
  5. web access
    By ashwinibm in forum Newbie
    Replies: 1
    Last Post: 15th January 2010, 10:27

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.