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
Sandeep Singh
NA
55
3.7k
How to retrieve image form database
Sep 30 2016 7:11 AM
Using this below code i am able to send my images to the database thru Linq to Sql
but i am unable to retrieve the images in PictureBox
private
void
btnUpload_Click(
object
sender, EventArgs e)
{
openFileDialog1.FileName =
""
;
openFileDialog1.Filter =
"Jpeg Images(*.jpg)|*.jpg|Bitmap Images(*.bmp)|*.bmp|All Images(*.*)|*.*"
;
DialogResult dr = openFileDialog1.ShowDialog();
if
(dr == DialogResult.OK)
{
imgPath = openFileDialog1.FileName;
pictureBox1.ImageLocation = imgPath;
}
}
Insert into Database-->
private
void
btnInsert_Click(
object
sender, EventArgs e)
{
int
? Cid =
null
;
if
(imgPath.Trim().Length > 0)
{
byte
[] data = File.ReadAllBytes(imgPath);
Binary img =
new
Binary(data);
dc.Customer_Insert(textBox2.Text, textBox3.Text,
decimal
.Parse(textBox4.Text),
int
.Parse(textBox5.Text),
img,
ref
Cid);
textBox1.Text = Cid.ToString();
}
else
{
dc.Customer_Insert(textBox2.Text, textBox3.Text,
decimal
.Parse(textBox4.Text),
int
.Parse(textBox5.Text),
null
,
ref
Cid);
textBox1.Text = Cid.ToString();
}
}
I want to display the image along with the whole information of Customer in my Window Application
Reply
Answers (
3
)
I have a model(Participant) containing collection model repr
Not in Clause in Linq To SQl