Quote:
Originally Posted by sumithsumith
anybody can help me to display the bytearray data into a text box????
i am able to use the Response.BinaryWrite()....
SqlConnection con=new SqlConnection("server=localhost;Persist Security Info=False;User ID=sa;password=sa;Initial Catalog=;Data Source=server0");
SqlCommand cmd = new SqlCommand("select book from name where id='" + TextBox3.Text + "'", con);
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
//Allocate an array of bytes to store it in temporarily:
byte[] image = null;
while (dr.Read())
{
image = (byte[])dr.GetValue(0);
string output = System.Text.Encoding.Unicode.GetString(image);
//TextBox4.Text=output;
Response.BinaryWrite(image);
It would depend on how the characters are packed into your byte array, but don't you want something like this:
- byte[] b = new byte[] { 65, 66, 67 };
-
MessageBox.Show( System.Text.Encoding.ASCII.GetString(b));