C# - How to get oracle long raw type value

前端 未结 2 1444
南笙
南笙 2020-11-30 12:58

How to get long raw type value with C#?

2条回答
  •  星月不相逢
    2020-11-30 13:49

    Here is Code to solve this issue.

              Byte[] img;
            con.Open();
            OracleCommand command = new OracleCommand("Select Image as BLOBDATA FROM tbltestImage ", con);
            command.InitialLONGFetchSize = -1;
            OracleDataReader rdr = command.ExecuteReader();
    
            DataTable dt = new DataTable();
            dt.Load(rdr);
            con.Close();
             if (dt.Rows.Count > 0)
            {
    
                if (dt.Rows[0]["BLOBDATA"].ToString() != "")
                {
    
                    img = (Byte[])dt.Rows[0]["BLOBDATA"];
    
    
                    MemoryStream ms = new MemoryStream(img);
    
                    Bitmap bitmap = new Bitmap(ms);
    
                    pictureBox2.Image = bitmap;
    
                    pictureBox2.SizeMode = PictureBoxSizeMode.StretchImage;
                }
    
    
    
    
            }
    

提交回复
热议问题