Hello again, everyone,
I haven't posted here in a while, meaning I haven't had to do much SQL programming lately. So, I'm quite rusty and might be asking silly questions again but that's what forums are for, right? Plus, I did search the Internet and this forum (reasonably).
Here's the question. I am trying to write some relatively large (~MB) binaries to a database table (SQL 2005, for now) from a C# program but (for now) not using ADO.Net for much more than executing SQL statements as performance is not important for this operation and I don't want to take the time to optimize anything at this point. So, I just want to do something like:
CREATE TABLE GVProgramsTable (ProgramID UNIQUEIDENTIFIER NOT NULL PRIMARY KEY, Name VARCHAR (128), Description VARCHAR (128), Program VARBINARY(MAX))
and then:
INSERT INTO GVProgramsTable (ProgramID, Name, Description, Program) VALUES ('ProgID', 'ProgName", 'ProgDescription', '

')
Obviously, SQL is not going to let you write a

, so I want to know what to put in there? I know it doesn't matter but I happen to be keeping the data in a MemoryStream object, which can be converted to a byte array. How do I represent that? A long hexadecimal representation of all the data as one large number, like so: '0x0001000000FFFFFFFF01000000000000000C020000004A4 ...'? If that is millions of characters long, wouldn't that cause a problem? After trying that with only 31KB of data, I get the "Implicit conversion from data type varchar(max) to varbinary(max) is not allowed. Use the CONVERT function to run this query." error. What am I doing wrong? Thanks in advance for your replies.
Kamen