i have a c# project with a table "Pics". it has two columns R_no(int) Picto(OLE). How i can store images if different formats in this table and retrieve it to show in a picture box. plz help me to solve this
my code is as below
string q2 = "select picto from pics where R_no=" +Convert.ToInt16(cmb_rno.SelectedItem) + "";
pictureBox1.Image = obj.toreader(q2);
public Image toreader(string qury)
{
Image img=null;
try
{
OleDbCommand cmd = new OleDbCommand(qury, mycon);
mycon.Open();
OleDbDataReader rdr = cmd.ExecuteReader(CommandBehavior.SequentialAccess);
if (rdr.Read())
{
MessageBox.Show("READ SUCCESFULLY");
byte[] b = (byte[])rdr.GetValue(0);
img = new Bitmap(new MemoryStream(b, true));
}
mycon.Close();
return img;
}
catch (Exception ex)
{
mycon.Close();
MessageBox.Show("Eror While reading by reader\n"+ex.Message);
return img;
}
it gives error like this "parameter is not valid"