Load Image From Db Problem
Unsolved
General and Desktop
-
@VRonin
yes of course
thanks so muchthis is code :
void Medical_Records::initalizeVarables() { shootScreen(); QBuffer inBuffer( &inByteArraye ); inBuffer.open(QIODevice::WriteOnly); originalPixmap.save(&inBuffer,"PNG"); } void Medical_Records::submitWithScreenShot() { initalizeVarables(); QSqlQuery sql; sql.exec("UPDATE Patient_File SET SskeletonPic='"+inByteArraye+"' WHERE SmeliCode='"+seMcode+"';"); }
-
yep, you should check QSqlQuery::bindValue
sql.prepare("UPDATE Patient_File SET SskeletonPic= :skp WHERE SmeliCode= :smc"); sql.bindValue(":skp",inByteArraye); sql.bindValue(":smc",seMcode); sql.exec();
this also prevents SQL Injection. You should never really use unescaped input directly to build the query string