我在网上找了很多方法都不行,哪位兄弟帮个忙,贴一段确切可行的代码....实在是找不到了读写CLOB/BLOB?????

解决方案 »

  1.   

    www.codeproject.com去看看应该有类似的
      

  2.   

    连接字符串:
    <add key="ConString" value="Data Source=int64;User Id=center;Password=center;" />如果是Oracle9,那么要注意权限的设置
      

  3.   

    BLOG用SQL语句是不能直接插入的,必须先插入一个空数据empty_blob(),然后再
    private void SaveFile(int data_id,byte[] p_Blob,string id,string photo,string tablename,OracleConnection mConn)
    {
    try
    {
    OracleDataAdapter photoAdapter;
    DataSet photoDataSet;
    DataTable photoTable;
    DataRow photoRow; photoAdapter = new OracleDataAdapter(
    "SELECT "+id+","+photo+"" +
    "  FROM "+tablename+" WHERE "+id+" = " + data_id,mConn);
    photoDataSet= new DataSet(tablename);
    photoAdapter.UpdateCommand = new OracleCommand
    ("UPDATE "+tablename+" SET " +
    ""+photo+" = :vPHOTO " +
    "WHERE "+id+" = :vID",mConn);
    photoAdapter.UpdateCommand.Parameters.Add(":vPHOTO",
    OracleType.Blob, p_Blob.Length, photo);
    photoAdapter.UpdateCommand.Parameters.Add(":vID",
    OracleType.Int32, 0, id); photoAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey; // Configures the schema to match with Data Source
    photoAdapter.FillSchema(photoDataSet, SchemaType.Source, tablename); // Fills the DataSet with 'drivers' table data
    photoAdapter.Fill(photoDataSet,tablename); // Get the current driver ID row for updation
    photoTable = photoDataSet.Tables[tablename];
    photoRow = photoTable.Rows.Find(data_id); // Start the edit operation on the current row in
    // the 'drivvers' table within the dataset.
    photoRow.BeginEdit();
    // Assign the value of the Photo if not empty
    if (p_Blob.Length != 0)
    {
    photoRow[photo] = p_Blob;
    }
    // End the editing current row operation
    photoRow.EndEdit(); // Update the database table 'drivers'
    photoAdapter.Update(photoDataSet,tablename); }
    catch(Exception e)
    {
    throw e;
    }
    } #endregion用DATASET 方式插入数据
      

  4.   

    也可以直接用DATASET 用上述方式插入,直接使用SQL语句是无法插入的。
      

  5.   

    用System.Byte[]类型
    parameter.OracleType = OracleType.Blob
    parameter.Value = System.Byte[]类型的变量
      

  6.   

    http://www.codeproject.com/useritems/C__and_Oracle.asp?df=100&forumid=288287&select=1456234#SEE IN CODEPROJECT,THANKS