473,385 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to display data from a bytearray to a textbox

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);
Apr 2 '07 #1
1 3724
SammyB
807 Expert 512MB
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:
Expand|Select|Wrap|Line Numbers
  1.  byte[] b = new byte[] { 65, 66, 67 };
  2. MessageBox.Show( System.Text.Encoding.ASCII.GetString(b));
Apr 2 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Mike | last post by:
I need to display data in text boxes not datagrid, can anyone point to some examples on how this is done in VB.NET? in the old way it was <input type="text" value=<% dataitem %> > how can i do...
1
by: anoop | last post by:
hello, how can I display data from a Data source such as SQL Server in a textbox by using the click of a Button on an .aspx page in a Visual Basic ..Net Project . If I have to use a DataSet, then...
3
by: remya1000 | last post by:
i'm using ASP with MSAccess as database. i have two buttons and two textbox in my page. when i press my first button (First month) i need to display the current month in one textbox and last one...
1
by: geeteshss | last post by:
First i would like to thank those persons who helped me out in solving my earlier problems the present problem is that i am unable to display data in datagrid....... but the data is visible in...
4
by: jain19801 | last post by:
I Have Created Connection Object, Dataadapter And Fill The Dataset But Afterwards I Am Unable To Display The Data In Textbox Or Label
1
by: suhasini ramanan | last post by:
Hi, I want to display the data from a database table using text box..... am developing this asp.net page with c# coding..... please help me with the code hope to hear from u soon :)
2
arun3232
by: arun3232 | last post by:
how can i display data to textbox using sql server in asp.net with c#..
3
by: yookify | last post by:
Sorry For the previous post i send .I dont know i should not use short words. I need help.... This coding works well... While y.Read() Response.Write("Name i " & y("LastName"))...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.