Image location to MySql Database
hi
I am using Mysql database.
I am trying to insert an image location in to my database but its not
saving properly.if i choose an image "E:\Production\Images\image001.jpg"
its saving like this "E:ProductionImagesimage001.jpg"
//this is my code
private void button2_Click(object sender, EventArgs e)
{
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);
//I am using a class
c.cmd = new MySqlCommand("SELECT COUNT(*) FROM image_table;", c.conn());
maxVal = Convert.ToInt32(c.cmd.ExecuteScalar().ToString());
c.conn();
string query = "INSERT INTO image_table (IMAGE_NO,
IMAGE_LOCATION, ASSIGN_DATE, ASSIGN_TO, ASSIGN_BY) VALUES ('" + (maxVal +
1) + "', '" + open.FileName+ "', '" + this.Assign_date.Value + "','" +
Class1.AssignTo + "','" + Class1.userName + "')";
{
c.cmd = new MySqlCommand(query, c.conn());
//Execute command
c.cmd.ExecuteNonQuery();
c.conn().Close();
}
}
}
Please suggest a method to solve this problem.I am stuck,the code isn't work.
Thank u