In an ASP.NET app (using framework 2.0), and the ORM for this application is Subsonic 2.2, which I'm working with for the first time.
I have an image which I've retrieved from a URL, and I have an HttpWebresponse object, which I've converted to an image, like this:
string uri = ...;
HttpWebRequest lxRequest = (HttpWebRequest) WebRequest.Create(uri);
HttpWebResponse lxResponse = (HttpWebResponse) lxRequest.GetResponse();
System.Drawing.Image image = System.Drawing.Image.FromStream(lxResponse.GetResponseStream());
In Sql Server, I've created an Image column (could be any other binary format, that's not a problem), and I'd like to write my image into it. I'd also like to know how to read from the column, so as to test that the image has been correctly saved.
Any help appreciated. Thanks.
For a
image
column, Subsonic creates abyte[]
property.Therefore, you'll have to transform your data (
System.Drawing.Image
in this case) to and from a byte array.Other sites have this covered, shamelessly copied: