Link to home
Start Free TrialLog in
Avatar of existenz2
existenz2Flag for Netherlands

asked on

Insert byte array into SQLServer

I have the following problem:

I have a file which I need to insert into the database in a binary field (Image field is also a possibilty, but the file I need to insert is not an image) through a plain query with C#.

At the moment I got this:
INSERT INTO table(ID,File) VALUES('{0}','{1}');

where 0 is a Unique Identifier and 1, the binary data. But that isnt working, because it is giving me back errors. What am I doing wrong/is the correct syntax?

Ps. I can use either a byte[] or a memorystream for the data, but I prefer a byte[].
ASKER CERTIFIED SOLUTION
Avatar of Nazermohideeen
Nazermohideeen

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of existenz2

ASKER

Not exactly what I was hoping for, but it solved my problem. Could have known that I should fix it this way ;) Thnx