I have a form that I currently attach images to which become a field in the sql table. I understand this is not an effecient way to perform this and it is better to store the image outside the database and have a link to a storage directory. Can anyone help me with this concept and how my code would change I currently have the following code for an object:
private void attachBN_Click_1(object sender, EventArgs e)
{
try
{
OpenFileDialog open = new OpenFileDialog();
open.Filter = "Image Files(*.jpg; *.jpeg; *.gif; *.bmp)|*.jpg; *.jpeg; *.gif; *.bmp";
if (open.ShowDialog() == DialogResult.OK)
{
pictureBox1.Image = new Bitmap(open.FileName);
}
}
catch (Exception)
{
throw new ApplicationException("Failed loading image");
}
}
private void removepartBN_Click(object sender, EventArgs e)
{
pictureBox1.Image = null;
}
private void attachBN_Click_1(object sender, EventArgs e)
{
try
{
OpenFileDialog open = new OpenFileDialog();
open.Filter = "Image Files(*.jpg; *.jpeg; *.gif; *.bmp)|*.jpg; *.jpeg; *.gif; *.bmp";
if (open.ShowDialog() == DialogResult.OK)
{
pictureBox1.Image = new Bitmap(open.FileName);
}
}
catch (Exception)
{
throw new ApplicationException("Failed loading image");
}
}
private void removepartBN_Click(object sender, EventArgs e)
{
pictureBox1.Image = null;
}