How to deal with foreign key in Qt?
General and Desktop
2
Posts
2
Posters
1.2k
Views
1
Watching
-
@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??