sql >> Database >  >> RDS >> Oracle

OracleLob als parameter doorgeven aan een functie

using(reader)
{
      //Obtain the first row of data.
      reader.Read();
      //Obtain the LOBs (all 3 varieties).
      OracleLob BLOB = reader.GetOracleLob(1);
      ...

      //Example - Reading binary data (in chunks).
      byte[] buffer = new byte[4096];
      while((actual = BLOB.Read(buffer, 0, buffer.Length)) >0)
         Console.WriteLine(BLOB.LobType + 
            ".Read(" + buffer + ", " + buffer.Length + ") => " + actual);

      ...
}

Persoonlijk zou ik op deze manier kolommen maken en toevoegen aan de DataTable, maar het is aan jou om het op deze manier te proberen of op een andere manier waarvan je weet dat deze zal werken

DataTable table = new DataTable("ImageTable"); //Create a new DataTable instance.

DataColumn column0 = new DataColumn("id"); //Create the column.
column.DataType = System.Type.GetType("System.String"); //Type string 

DataColumn column1 = new DataColumn("image"); //Create the column.
column.DataType = System.Type.GetType("System.Byte[]"); //Type byte[] to store image bytes.
column.AllowDBNull = true;
column.Caption = "My Image";

table.Columns.Add(column0); //Add the column to the table.
table.Columns.Add(column1); //Add the column to the table.

Then, add a new row to this table and set the value of the MyImage column.

DataRow row = table.NewRow();
row["MyImage"] = <Image byte array>;
tables.Rows.Add(row);



  1. kon mysql-procedure voor cursors niet compileren

  2. Tel de exemplaren in meerdere kolommen

  3. IP-adresweergave in de Maxmind Geolitecity-database

  4. Hoe 'java.lang.ClassNotFoundException:com.mysql.jdbc.Driver' te repareren nadat het is toegevoegd aan het buildpad en is geregistreerd met Class.forName();