existenz2
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[].
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER