View Full Version : store and retrieve binary data to/from remote sqlserver's image field

19th September 2009, 08:07

Dear Friends ,
I need to store and retrieve binary data from remote sql server's image field. now i can store binary value into remote server by simply simply reading the source file sontent into byte array and store that byte array content into a Qstring while usnig insert statement.
wBData is a byte array in which i read source file content
QString s1(wBData);
net.get(",photo)+values+(4 ,'"+ s1 +"')&root=blobinsert"

while retrieving sql server gives image field as a Binary base Encoded format i tried to docode.but decoded value does not creates original file i saved into the database

QByteArray wBData1;
net.get(" OR+XML+RAW,+BINARY+BASE64&root=blobinsert&contentt ype=text/xml")

wBData1.append(xml.attributes().value("photo").toS tring());

QByteArray by(QByteArray::fromBase64(wBData1));
fil.write(by); // write into a file