Results 1 to 3 of 3

Thread: how can i store and retrieve image & sound in Database

  1. #1
    Join Date
    Sep 2009
    Posts
    54
    Thanks
    4
    Thanked 3 Times in 3 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default 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

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: how can i store and retrieve image & sound in Database

    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.

  3. #3
    Join Date
    Sep 2009
    Posts
    54
    Thanks
    4
    Thanked 3 Times in 3 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default 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

Similar Threads

  1. Replies: 2
    Last Post: 14th September 2009, 08:38
  2. Best way to store and retrieve contents of QTableWidget?
    By codeslicer in forum Qt Programming
    Replies: 3
    Last Post: 6th April 2008, 09:39

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.