最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
c# ,在Oracle 中,对 blob 类型对象的操作
时间:2022-07-02 11:05:46 编辑:袖梨 来源:一聚教程网
尝试的情况是,提供一个TEXT 框,让用户输入,允许输入非常多的值,保存到Oracle 数据库中。
为了能够大量数据保存,因此,对字段类型设置为 blob 型 。
网络上的类似帮助太复杂了,发现如果只是文件内的操作,还是比较简单的。
思路:
1。先将text 文本转变成2进制
byte[] ddd;
ddd = System.Text.Encoding.Unicode.GetBytes(this.textBox1.Text);
2。再将该2进制存入数据库中,发现这种对数据库的访问方法可行。
cmd.Parameters.Add 。。。
cmd.ExecuteNonQuery();
表结构如下:
create table XLUTEST
(
HHHH BLOB,
GGGG VARCHAR2(10)
)
tablespace SYSTEM
pctfree 10
pctused 40
initrans 1
maxtrans 255
storage
(
initial 64K
minextents 1
maxextents unlimited
)
c# 全部WINFORM 代码如下 :
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.OleDb;
using System.IO;
namespace blob
{
///
/// Form1 的摘要说明。
///
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
///
/// 必需的设计器变量。
///
private System.ComponentModel.Container components = null;
public Form1()
{
为了能够大量数据保存,因此,对字段类型设置为 blob 型 。
网络上的类似帮助太复杂了,发现如果只是文件内的操作,还是比较简单的。
思路:
1。先将text 文本转变成2进制
byte[] ddd;
ddd = System.Text.Encoding.Unicode.GetBytes(this.textBox1.Text);
2。再将该2进制存入数据库中,发现这种对数据库的访问方法可行。
cmd.Parameters.Add 。。。
cmd.ExecuteNonQuery();
表结构如下:
create table XLUTEST
(
HHHH BLOB,
GGGG VARCHAR2(10)
)
tablespace SYSTEM
pctfree 10
pctused 40
initrans 1
maxtrans 255
storage
(
initial 64K
minextents 1
maxextents unlimited
)
c# 全部WINFORM 代码如下 :
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.OleDb;
using System.IO;
namespace blob
{
///
/// Form1 的摘要说明。
///
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
///
/// 必需的设计器变量。
///
private System.ComponentModel.Container components = null;
public Form1()
{
相关文章
- 哔哩哔哩漫画官网网页精选合集-哔哩哔哩漫画官网网页人气热作盘点 12-14
- 126邮箱登录入口-126邮箱网页版免费登录 12-14
- 学习通登录入口官网直达-学习通在线平台一键链接 12-14
- 192.168.1.1手机登录入口-设备限速管理一键直达 12-14
- 三国冰河时代最新兑换码2025全收集 12-14
- iCloud文件备份管理登录入口-iCloud登录入口快速定位查找设备 12-14