Results 1 to 5 of 5

Thread: Postgresql delete record error

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2011
    Posts
    3
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Postgresql delete record error

    Hello All.
    I'm working on Qt 4.8-Postgresql application,I'm Using the following code to delete a database record the code works perfect, but if there is a data related to that table in another table an error 23503 raised till now everything is ok. Now if I delete the data related in the other table and execute the same code again to delete the same record an error 42601 raised indicating syntax error at or near "("
    LINE 1: EXECUTE (77831, '30'). What could be the reason.
    Qt Code:
    1. QSqlQuery query ;
    2. query.prepare("DELETE FROM purchasing.invoice WHERE OID=:Oid AND invoice_id=:invoice_id ") ;
    3.  
    4. query.bindValue(":Oid" , Oid);
    5. query.bindValue(":invoice_id" , ui->invoice_id->text() );
    6.  
    7. query.exec();
    To copy to clipboard, switch view to plain text mode 

    Thank you in advance for your help.
    Last edited by amr2027; 29th November 2013 at 21:52.

  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: Postgresql delete record error

    What is the type of column invoice_id in database ?

  3. The following user says thank you to Lesiok for this useful post:

    amr2027 (30th November 2013)

Similar Threads

  1. Error Modifiying a record of a QSqlTableModel
    By qlands in forum Qt Programming
    Replies: 2
    Last Post: 28th July 2011, 10:41
  2. delete record from qsqltable
    By robotics in forum Qt Programming
    Replies: 2
    Last Post: 7th June 2011, 11:21
  3. Replies: 4
    Last Post: 10th May 2011, 12:19
  4. Replies: 2
    Last Post: 11th February 2011, 17:53
  5. Replies: 3
    Last Post: 26th March 2010, 04:32

Tags for this Thread

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.