本文整理汇总了C#中System.Data.OracleClient.OracleBFile类的典型用法代码示例。如果您正苦于以下问题:C# OracleBFile类的具体用法?C# OracleBFile怎么用?C# OracleBFile使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OracleBFile类属于System.Data.OracleClient命名空间,在下文中一共展示了OracleBFile类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetOracleBFile
private void GetOracleBFile(string connectionString)
{
//Create and open the connection.
using (OracleConnection connection = new OracleConnection(connectionString))
{
connection.Open();
//Create and execute the commands.
OracleCommand command = connection.CreateCommand();
command.CommandText = "CREATE OR REPLACE DIRECTORY TestDir AS 'c:\\bfiles'";
command.ExecuteNonQuery();
command.CommandText = "CREATE TABLE TestTable(col1 number, col2 BFILE)";
command.ExecuteNonQuery();
command.CommandText = "INSERT INTO TestTable VALUES ('2', BFILENAME('TESTDIR', 'File.jpg'))";
command.ExecuteNonQuery();
command.CommandText = "SELECT * FROM TestTable";
//Read the BFile data.
byte[] buffer = new byte[100];
OracleDataReader dataReader = command.ExecuteReader();
using (dataReader)
{
if (dataReader.Read())
{
OracleBFile BFile = dataReader.GetOracleBFile(1);
using (BFile)
{
BFile.Seek(0, SeekOrigin.Begin);
BFile.Read(buffer, 0, 100);
}
}
}
}
return;
}