01.
if
(op.ShowDialog() == System.Windows.Forms.DialogResult.OK)
02.
{
03.
if
(op.CheckPathExists)
04.
{
05.
string
CorrectFilename = System.IO.Path.GetFileName(op.FileName);
06.
SqlCommand cmd =
new
SqlCommand(
"UPDATE Command_Prices set c_photo='\\image\\" + CorrectFilename + "
'where id =
'" + txt1.Text + "'
)", con);
07.
cmd.ExecuteNonQuery();
08.
con.Close();
09.
string
path = Application.StartupPath.Substring(0, (Application.StartupPath.Length - 10));
10.
System.IO.File.Move(op.FileName, path +
"\\image\\"
+ CorrectFilename);
11.
MessageBox.Show(
"Successfully Uploaded"
);
12.
}
13.
}