private void btnSubmit_Click(object sender, EventArgs e) { byte[] picbyte = System.IO.File.ReadAllBytes(textBox.Text); try { string constr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=.\\PIS(ACU).mdb;"; Con = new OleDbConnection(@constr); Con.Open(); Com = new OleDbCommand(); Com.Connection = Con; Com.CommandText = "INSERT INTO PatientImages (Patient_Id,ImageDate,Photo,ImageName)VALUES(" + txtPatientId.Text + ",'" + txtImageDate.Value.ToString("yyyy/MM/dd HH:mm:ss") + "', @Photo ," + txtImageName.Text + ")"; OleDbParameter picParam = Com.Parameters.Add("@Photo", SqlDbType.Binary); picParam.Value = picbyte.ToArray(); picParam.Size = picbyte.ToArray().Length; Com.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { Con.Close(); MessageBox.Show("Image Uploaded Successfully", "PIS System"); } }
txtImageName.Text
@Photo
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)