这是一个使用c#和过程在oracle中插入blob数据的示例(你说更喜欢这意味着你可能).
using System;
using System.Data;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
using System.IO;
using System.Text;
//Step 1
// Connect to database
// Note: Modify User Id, Password, Data Source as per your database setup
string constr = "User Id=Scott;Password=tiger;Data Source=orcl9i";
OracleConnection con = new OracleConnection(constr);
con.Open();
Console.WriteLine("Connected to database!");
// Step 2
// Note: Modify the Source and Destination location
// of the image as per your machine settings
String SourceLoc = "D:/Images/photo.jpg";
String DestinationLoc = "D:/Images/TestImage.jpg";
// provide read access to the file
FileStream fs = new FileStream(SourceLoc, FileMode.Open,FileAccess.Read);
// Create a byte array of fi

本文提供了一个使用 C# 和 Oracle 数据库连接插入 BLOB 数据的详细步骤。首先,建立数据库连接,然后读取本地图片文件为字节数组。接着,创建匿名 PL/SQL 块进行插入操作,并设置输入和输出参数。执行 SQL 命令将图片插入数据库,并通过输出参数获取 BLOB 数据。最后,将从数据库中取出的 BLOB 数据保存到目标位置。

873

被折叠的 条评论
为什么被折叠?



