TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sakthis
NA
50
18.7k
Error in retrieve the image from sql table to picturebox?
Oct 15 2013 7:52 AM
private void btnSearch_Click(object sender, EventArgs e)
{
SqlConnection CN = new SqlConnection("Data Source=sakthi\\sqlexpress; Initial Catalog=LoginDetails; Integrated Security=True");
SqlCommand cmd = new SqlCommand("select * from emp where empcode ='" + txtEmpCode.Text + "'", CN);
SqlDataReader myreader;
DataTable dt = new DataTable();
MemoryStream ms = new MemoryStream();
try
{
CN.Open();
myreader = cmd.ExecuteReader();
if (myreader.Read())
{
txtEmpCode.Text = myreader[0].ToString();
txtName.Text = myreader[1].ToString();
txtGender.Text = myreader[3].ToString();
byte[] pic = (byte[])myreader[2];
ms = new MemoryStream(pic);
ms.Seek(0, SeekOrigin.Begin);
pictureBox1.Image = Image.FromStream(ms);
}
else
{
MessageBox.Show("do not found");
}
CN.Close();
}
catch (Exception ex)
{ MessageBox.Show(ex.Message); }
}
Reply
Answers (
3
)
Chart and dates on x axis
CrystalReport's Section Doesn't have property of AddTextObje