Thanks for the tip, this is the error message I get
insert into clients (`cid`, `firstName`, `lastName`, `address`, `zipCode`, `city`, `phoneNr`, `email`) values ( '', :firstName, :lastName, :address, :zipCode, :city,
![Stick Out Tongue](images/smilies/tongue.png)
honeNr, :email)
So the prepare and the bindValue isn't working properly, is there anybody familiar with this problem?
I've found something I'm passing QString vars in the bindValue, I've changed it to QVariant but that works neither.
Could it be that it won't work because I'm converting a QString to QVariant;
Here's the code to get the text
QString strFirstName
= firstNameLine
->text
();
QString strLastName
= lastNameLine
->text
();
QString strAddress
= addressLine
->text
();
QString strZipCode
= zipCodeLine
->text
();
QString strCity
= cityLine
->text
();
QString strPhoneNr
= phoneNrLine
->text
();
QString strEmail
= emailLine
->text
();
if(database->addClient(strFirstName, strLastName, strAddress, strZipCode, strCity, strPhoneNr, strEmail)){
clientDialog->accept();
}else{
QMessageBox::critical(clientDialog,
"Error",
"Er is een fout opgetreden bij het invoeren van een klant, neem contact op met de ontwikkelaar!");
}
QString strFirstName = firstNameLine->text();
QString strLastName = lastNameLine->text();
QString strAddress = addressLine->text();
QString strZipCode = zipCodeLine->text();
QString strCity = cityLine->text();
QString strPhoneNr = phoneNrLine->text();
QString strEmail = emailLine->text();
if(database->addClient(strFirstName, strLastName, strAddress, strZipCode, strCity, strPhoneNr, strEmail)){
clientDialog->accept();
}else{
QMessageBox::critical(clientDialog, "Error", "Er is een fout opgetreden bij het invoeren van een klant, neem contact op met de ontwikkelaar!");
}
To copy to clipboard, switch view to plain text mode
and here's the code of the function
bool db::addClient(QVariant strFirstName, QVariant strLastName, QVariant strAddress, QVariant strZipCode, QVariant strCity, QVariant strPhoneNr = "", QVariant strEmail = ""){
To copy to clipboard, switch view to plain text mode
Bookmarks