Store Image into SQL 2008

I’m having an issue saving images to the sql 2008, I get an The index 2 is out of range error, my table has 2 columns ndx INT and image VARBINARY(max)
below is the code I’m using, I have also attached the error code.

path = system.file.openFile() if path != None: bytes = system.file.readFileAsBytes(path) system.db.runPrepUpdate(" INSERT INTO JDEPARTIMG (ndx,image) Values(10,Cast(? as varbinary(max))",(bytes))

path = system.file.openFile() if path != None: bytes = system.file.readFileAsBytes(path) system.db.runPrepUpdate(" INSERT INTO JDEPARTIMG (ndx,image) Values(10,?)",[bytes])

Thank you!, I did’t notice the square brackets in the other thread, the manual has parenthesis?
what would be the best way to display the image in an image component?