when inserting records in database from image control the bytes won't change however image path changes ... what's going wrong with me ??? please guide me here's my code
protected void Save_Click(object sender, EventArgs e)
{
// Read the file and convert it to Byte Array
string filePath = Server.MapPath(Image1.ImageUrl);
FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.ReadWrite);
BinaryReader br = new BinaryReader(fs);
Byte[] bytes = br.ReadBytes((Int32)fs.Length);
br.Close();
fs.Close();
br.Dispose();
fs.Dispose();
Response.Flush();
Response.Clear();
//insert the file into database
string strQuery = "INSERT INTO [dbo].[Image] ([Image],[date],[FilePath]) VALUES (@Image,@Date,@FilePath)";
SqlCommand cmd = new SqlCommand(strQuery);
cmd.Parameters.Add("@Date", SqlDbType.VarChar).Value = DateTime.Now.ToShortDateString();
cmd.Parameters.Add("@Image", SqlDbType.Binary).Value = bytes;
cmd.Parameters.Add("@FilePath", SqlDbType.NVarChar).Value = Server.MapPath(Image1.ImageUrl);
InsertUpdateData(cmd);
lbl_output.Text = Server.MapPath(Image1.ImageUrl);
}