iman.tv
iman.tv

Reputation: 97

how can I read content of image data from sql server database

I have a ArcSDE SQL server database. according to arcSDE schema CodedValues for domains in geodatabase stored in GDB_CODEDDOMAINS table in IMAGE format. how can I convert this image data type of coded values to string that can be human understandable. In other word I want to convert this data type to string and extract each code value of domain in separate string variable. please give me idea to do this work.

If the question is unclear pleas tell me to explain more!

Upvotes: 1

Views: 5080

Answers (2)

crs0794
crs0794

Reputation: 91

public Image byteArrayToImage(byte[] byteArrayIn)
{
     MemoryStream ms = new MemoryStream(byteArrayIn);
     Image returnImage = Image.FromStream(ms);
     return returnImage;
}

http://www.codeproject.com/Articles/15460/C-Image-to-Byte-Array-and-Byte-Array-to-Image-Conv

Upvotes: 0

Thorsten Dittmar
Thorsten Dittmar

Reputation: 56697

The contents of an IMAGE type column come back to C# as a byte[]. You can basically do anything with it. My first guess would be to try to convert it to a string using

string content = Encoding.UTF8.GetString(buffer);

Upvotes: 1

Related Questions