JCWEBHOST
asked on
sql query in text
hey guys i have a problem.
i can not insert a image to my database using text query?
(object)(Session["image"])
i have a sql = (insert (img)values((object)(Sessi on["image" ]))
do not work, couse i pass the text sql to a method
please help?
i can not insert a image to my database using text query?
(object)(Session["image"])
i have a sql = (insert (img)values((object)(Sessi
do not work, couse i pass the text sql to a method
please help?
I'd do it using a Parameter on you SqlCommand object that contains the binary list from your Session State - that's what has worked well for me, and it's also a bit easier to read, since it separates the insert itself from the content.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
In straight TSQL you cannot do this unless it is a binary stream, so the client usually handles putting the data into a binary stream.
NOTE: If you are on SQL 2005, in the future the type "image" is deprecated and will be removed from the product. I would advise using varbinary(max) instead. The insert is still the same.