Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to deal with foreign key in Qt?

How to deal with foreign key in Qt?

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    DrizzleX
    wrote on last edited by
    #1

    @else
    {
    query->prepare ("insert into Courses values (?,?,?)");
    query->bindValue (0,courseIDLine->text ());
    query->bindValue (1,courseNameLine->text ());
    query->bindValue (2,courseTeacherIDLine->text ());

        successful=query->exec ();
    
    }
    
    if(successful)
    {
        closeInsertCourseDlg ();
    }
    else if(!errorMsg->isVisible ())
    {
                //indicate that cannot execute the statement
    }@
    

    but if the SQL statement doesn't satisfy the foreign key, the program will end unexpectedly, saying that the statement have conflicts with foreign key in SQL Server.

    it will not just return a false

    how to change the code??

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      errorMsg is null or otherwise invalid.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved