Insert Hexadecimal In Blob Fiels Mssql

Hi,

I’m trying to insert hexadecimal data in a blob field. I alredy done this before with an self made Statement:

$values = “(‘1’ , ‘0’ , ’ 1’, 0x”.$hexdata." , ‘filename’ ,‘filesize’ , ‘fileextension’,’" . $date . “’)”;

$sql = "INSERT INTO BELEGBLOB (BELEGID, TYP, SEITENZAHL, [BINARY], [FILENAME], FILESIZE, FILETYPE, ERSTELLUNGSDATUM) VALUES " . $values . ";";

Note: this only works, because there are no quotes before and after hexdata(the hexadecimal data to insert).

THis way isn’t an option for me cause the performance is horrible. Somewhere is lost much time. It’s not the database and it’s not the function. The command->execute statement takes the most time.

That’s the reason why i tried to insert it with “addparam” and to instance and insert it via Model. But I had no success. The Problem is that in every case there are questionmarks added.

Are there any suggestions or opinions for an other way?

Thank in advance