problem while retriving image from firebird database in c#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • avvarumurali
    New Member
    • Nov 2007
    • 2

    problem while retriving image from firebird database in c#

    Hi,
    iam doing c# windows application.
    i save a image into the database,but iam unable to retrive image from database
    it is giving error "parameter is not valid ";
    mycode is :
    string query = "select photo from cust1 where id=" + id;
    FbDataAdapter adb = new FbDataAdapter(q uery, cnn);
    DataSet ds = new DataSet();
    adb.Fill(ds, "cust1");
    if (ds.Tables[0].Rows.Count > 0)
    {
    DataRow dr;
    dr = ds.Tables[0].Rows[0];
    if (!dr["photo"].Equals(DBNull. Value))
    {
    byte[] content = (byte[])dr["photo"];
    MemoryStream stream = new MemoryStream(co ntent);
    photo = stream;

    }
    }

    Bitmap img = new Bitmap(objcls.p hoto);-----------------------"error"

    pictureBox1.Siz eMode = PictureBoxSizeM ode.StretchImag e;
    pictureBox1.Ima ge = img;
    please give me information where the problem is
    Last edited by avvarumurali; Feb 23 '08, 12:23 PM. Reason: to give more information
  • avvarumurali
    New Member
    • Nov 2007
    • 2

    #2
    problem while retriving image from firebird database in c#

    Hi,
    iam doing c# windows application.
    i save a image into the database,but iam unable to retrive image from database
    it is giving error "parameter is not valid ";
    mycode is :
    string query = "select photo from cust1 where id=" + id;
    FbDataAdapter adb = new FbDataAdapter(q uery, cnn);
    DataSet ds = new DataSet();
    adb.Fill(ds, "cust1");
    if (ds.Tables[0].Rows.Count > 0)
    {
    DataRow dr;
    dr = ds.Tables[0].Rows[0];
    if (!dr["photo"].Equals(DBNull. Value))
    {
    byte[] content = (byte[])dr["photo"];
    MemoryStream stream = new MemoryStream(co ntent);
    photo = stream;

    }
    }

    Bitmap img = new Bitmap(objcls.p hoto);-----------------------"error"

    pictureBox1.Siz eMode = PictureBoxSizeM ode.StretchImag e;
    pictureBox1.Ima ge = img;
    please give me information where the problem is

    Comment

    • kenobewan
      Recognized Expert Specialist
      • Dec 2006
      • 4871

      #3
      For a start you need to use & instead of +. HTH.

      Comment

      Working...