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