VC2005 BOLB数据的读取和更新

VC2005 BOLB数据的读取和更新

 1             Encoding ^  ascii  =  Encoding::ASCII;
 2             oleDbDataAdapter1 -> MissingSchemaAction  =  MissingSchemaAction::AddWithKey;
 3             oleDbDataAdapter1 -> Fill(dataSet11);
 4             table1  =  dataSet11 -> Tables[ " userinfo " ];
 5             row  =  table1 -> Rows[ 0 ];
 6             FileStream ^  fs2  =  gcnew FileStream( " E:\\test1.rtf " ,FileMode::OpenOrCreate, FileAccess::Read);
 7             array < Byte >^ bytes2  =  gcnew array < Byte > (( int )fs2 -> Length);
 8             fs2 -> Read(bytes2, 0 ,( int )fs2 -> Length);
 9             fs2 -> Close();
10             row[ " rtfconn " =  bytes2;
11             oleDbDataAdapter1 -> Update(dataSet11, " userinfo " );            
12             array < Byte >^ bytes  =  (array < Byte >^ )row[ " rtfconn " ];
13              int  ArraySize  =  bytes -> GetUpperBound( 0 );
14             FileStream ^  fs  =  gcnew FileStream( " E:\\test.rtf " ,FileMode::OpenOrCreate, FileAccess::Write);
15             fs -> Write(bytes, 0 ,ArraySize);
16             fs -> Close();            
17             richTextBox1 -> LoadFile( " E:\\test.rtf " );

上面是读和写入一个Access库中的rtf文件的核心代码。

你可能感兴趣的:(VC2005 BOLB数据的读取和更新)