Can the image data type be changed into a byte array in sybase? I apply the web service to set data in the (image data type) I use byte [] to return the web service. Then I want to show the image "response.binarywrite (byte [])" I use. (ASP.NET C #) but there is an image distortion problem (when I zune in the image, some points are remembered). I do not know how anyone knows that the image data type in Sybase can be transferred to the byte array?
System:
1 Sybase
Sybase DB: 11.9.2 Adaptive Server Enterprise 12.5.1 Sybase. Data. ASC client: 1.0.152.0
2 ASP.NET C # (Visual Studio 2008)
3 IE 6
< Div class = "post-text" itemprop = "text">
Finally, let me know. The cause of this problem is the limit on the size of the image in Sybase when the size of the image is more than 37k bytes, the output is still 37K, so I miss some bytes in this step. The solution is that you have to set the parameter to retrieve all the data. Partial codes are shown below:
[WebMethod] public byte [] image (string c, string r) {// check input .. connection dubbs connbaseloc = new ConnectionDatabase (); Eclipse conn1 = null; ASCOMMand CMD1 = Faucet; String sqlstr1 = ""; Acadata Reader Reader = Faucet; Byte [] Imagebytes = null; Try {{conn1 = connbaseloc.Odbcconn_xxx ()) {string setTextCmd = "SET TEXTSIZE 130000"; // set parameter cmd1 = new precom (setTextCmd, conn1); Cmd1.ExecuteNonQuery (); Sqlstr1 = "select ...."; CMD1 = new Ace Command (sqlstr1, conn1); Cmd1.CommandText = sqlstr1; Reader = CMD1 Spare reader (); While (reader.Read ()) {Imagebytes = (byte []) reader ["image"]; }}} Hold (exception e) {// do something} finally {if (conn1! = Null) conn1.Close (); } Returns Imagebytes; }
The parameter value depends on the images of your maximum size.
No comments:
Post a Comment