hi, I am using SQL client as the database and VS 2008 standard to bild my project. i need to browse for a file and upload it to the SQL database. how can I do this ?? I have the code to browse for the file and insert to the database, but it dosen't work, can someone hilp me with this. My code is shown below. My code is onlt for pictures how can i upload different format of files. I need to save the path of the file and the file in the database , how can i do this. My code
OpenFileDialog dlg = new OpenFileDialog();
DialogResult dlgRes = dlg.ShowDialog();
if (dlgRes != DialogResult.Cancel)
//Set image in picture box
pictureBox1.ImageLocation = dlg.FileName;
//Provide file path in txtImagePath text box.
txtImagePath.Text = dlg.FileName;
String query = @"Insert ImagesStore(OriginalPath,ImageDarta) Values ('" + txtImagePath.Text + ",'" + pictureBox1.ImageLocation + "')";
SqlCommand command = new SqlCommand(query, DB.getConnection());
THERE IS AN ERROR IN command.ExecuteNonQuery(); , IT SAYS "Incorrect syntax near 'C:'. Unclosed quotation mark after the character string ')'."
THE TABLE IS ImageStore :
OriginalPath varchar(MAX) ImageData varchar(MAX)
WHAT IS THE ERROR IN THIS LINE
PLEASE CAN I GET A ANSWER FOR MY QUESTION THANK YOU