how can i store and retrieve image & sound in Database
Dear Friends,
how can i store and retrieve Image and sound files to/from Database.
i can store and retrieve image files to/from database by reading the file contents into byte array and store it into the database, same process is used to retrive from dB.
QFile fileIn ("Beeth.wma");
if (fileIn.open (QIODevice::ReadOnly))
{
QByteArray wBData(fileIn.readAll());
QString DocData.append(wBData);
}
then insert into Tab(....)values(...Docdata);
but this process is not working for sound files. How can i resolve it....
I wondered if anybody gave solution.
Thanks,
Askar
Re: how can i store and retrieve image & sound in Database
Quote:
QString DocData.append(wBData);
what is that supposed to do?
I would use a prepared statement (see QSqlQuery::prepare()) and then bind the QByteArray to it.
Re: how can i store and retrieve image & sound in Database
i could not able to bind the QByteArray directly. so what i converted QByteArray to QString before i call bind function