C# Wimform Access DataBase

  • Thread starter Thread starter Booney440
  • Start date Start date
B

Booney440

Guest
Hello All

I have a Winform with a Access Data Base I am trying to add a picture to the Data Base. I'm getting the error (Failed to Convert parameter value from a Byte[] to a String). Access Data Type is OLE Object. I built this off another project that works fine.

Any help much Appreciated

1485569.jpg1485571.jpg


private void btn_Browse_Click(object sender, EventArgs e)
{
try
{
using (OpenFileDialog ofd = new OpenFileDialog() { Filter = "JPEG|*.JPG", ValidateNames = true, Multiselect = false })
{
if (ofd.ShowDialog() == DialogResult.OK)
pictureBox1.Image = Image.FromFile(ofd.FileName);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}


private void btn_Save_Click(object sender, EventArgs e)
{
try
{
Edit(false);
test_Trial_RosterBindingSource.EndEdit();
test_Trial_RosterTableAdapter.Update(rosterDataSet.Test_Trial_Roster);
test_Trial_RosterDataGridView.Refresh();


// maskedTextBox2.Focus();
MessageBox.Show("You data has been Successfully saved.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
rosterDataSet.Test_Trial_Roster.RejectChanges();
}
}





Booney440

Continue reading...
 
Back
Top