locked
Parameter is not valid RRS feed

  • Question

  • User1938740042 posted

    whts the reason for the error "Parameter is not valid."

    i wanna retreive the image into picturebox1 from DB and  m trying below code snipped in a window application page using C# and MYSQL 5.0.

    here "ExecuteScalar" returns a byte array of certain dimension (say 13) depends upon the image size that store in DB. 

     

    MySqlConnection con = new MySqlConnection(ConfigurationSettings.AppSettings["connectionString"]);

    try

    {

    con.Open();

    MySqlCommand cmd = new MySqlCommand("SELECT STR_PICTURE FROM STORE_MASTER WHERE STR_ADMIN_YN='N'", con);

    byte[] image = (byte[])cmd.ExecuteScalar();

     

    MemoryStream ms1 = new MemoryStream(image);

    ms1.Write(image, 0, image.Length);

    pictureBox1.Image = System.Drawing.Bitmap.FromStream(ms1); //Error Occured at this line

    }

    catch { }

    finally

    {

    con.Close();

    }

    plz help me!

    Ajmal

    Monday, February 19, 2007 1:49 AM

Answers