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
Sousa Pambo
NA
92
23.9k
Get image/picture from database
Mar 16 2014 3:29 PM
Hi fellow, I need your help. I don't get the error on this
my Crud
public Image GetFuncImage(UIL.frmFunc FC, string lbFuncID)
{
string sql = "select funcFoto from FuncData where nomeFunc ='" + lbFuncID + "'";
using (SqlConnection myconn = new SqlConnection(con.stringConexaoRH()))
{
try
{
myconn.Open();
using (SqlCommand comand = new SqlCommand(sql, myconn))
{
using (SqlDataReader dtreader = comand.ExecuteReader())
{
if (dtreader.Read())
{
Byte[] bytePicData = dtreader["funcFoto"] as byte[] ?? null;
if(bytePicData != null)
{
MemoryStream mstream = new MemoryStream(bytePicData);
FC.pbFuncFoto.Image = System.Drawing.Image.FromStream(mstream);
{
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(mstream);
}
}
}
}
}
}
catch (Exception ex)
{
return FC.pbFuncFoto.Image = RH_2013.Properties.Resources.icon_employer;
}
}
return FC.pbFuncFoto.Image = RH_2013.Properties.Resources.icon_employer;
}
}
__________________________________________________________________________________________
my Event
private void pbFuncFoto_Click(object sender, EventArgs e)
{
this.pbFuncFoto.Image = FuncDal.GetFuncImage(this, this.lbIdFunc.Text);
}
__________________________________________________________________________--
Where I'm wrong here....
Reply
Answers (
13
)
Characters Magnifying
file operation error