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
paddu v
NA
53
49.6k
How to insert image into Database,In database profilepic datatype is varBinary(Max)
Jun 28 2012 9:37 AM
private void btnBrowse_Click(object sender, EventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
dlg.Title = "Open Photo";
dlg.Filter = "jpg files(*.jpg|*.jpg|All files(*.*)|*.*";
if (dlg.ShowDialog() == DialogResult.OK)
{
pictureBox1.Image = new Bitmap(dlg.OpenFile());
}
dlg.Dispose();
}
private void btnAdd_Click(object sender,EventArgs e)
{
MemoryStream ms = new MemoryStream();
pictureBox1.Image.Save(ms, ImageFormat.Jpeg);
ms.Position = 0;
ms.Read(photo, 0, Convert.ToInt32(photo.Length));
pinfo.profilepic=photo//here i am getting error why because the datatype convertion problem.
photo is Byte[] type
and
profilepic is Binary type
}
please give me answer
Reply
Answers (
2
)
asp.net
Getting info from a textbox with password char property set to true...