惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Cloudbric
Cloudbric
E
Exploit-DB.com RSS Feed
SecWiki News
SecWiki News
Forbes - Security
Forbes - Security
N
News | PayPal Newsroom
S
Security @ Cisco Blogs
Schneier on Security
Schneier on Security
V
V2EX - 技术
S
Secure Thoughts
W
WeLiveSecurity
Google DeepMind News
Google DeepMind News
C
CERT Recently Published Vulnerability Notes
NISL@THU
NISL@THU
S
Securelist
S
Security Archives - TechRepublic
Know Your Adversary
Know Your Adversary
V
Vulnerabilities – Threatpost
Security Latest
Security Latest
Recent Commits to openclaw:main
Recent Commits to openclaw:main
G
GRAHAM CLULEY
H
Hacker News: Front Page
Microsoft Azure Blog
Microsoft Azure Blog
I
Intezer
Google Online Security Blog
Google Online Security Blog
美团技术团队
阮一峰的网络日志
阮一峰的网络日志
T
The Exploit Database - CXSecurity.com
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Webroot Blog
Webroot Blog
Jina AI
Jina AI
Engineering at Meta
Engineering at Meta
P
Proofpoint News Feed
The Cloudflare Blog
I
InfoQ
L
LangChain Blog
U
Unit 42
P
Proofpoint News Feed
S
Schneier on Security
S
Security Affairs
Y
Y Combinator Blog
T
Tenable Blog
N
News and Events Feed by Topic
MyScale Blog
MyScale Blog
量子位
Google DeepMind News
Google DeepMind News
Cyberwarzone
Cyberwarzone
博客园 - 聂微东
D
Darknet – Hacking Tools, Hacker News & Cyber Security
GbyAI
GbyAI
AWS News Blog
AWS News Blog

博客园 - amber lee zhao

(武义检察院)sqlplus执行sql脚本 windows下squid安装与配置 缓存服务器 System.Data.OracleClient requires Oracle client software version 8.1.7 or greater. Oracle Listener crash in Windows 【转】Session丢失原因分析 【转】Session丢失问题二 【转】Session丢失问题解决方法一 OracleMembershipProvider、OracleRoleProvider源代码 使用System.Net.Mail发送邮件 - amber lee zhao 【转】oracle SQL性能优化 DataGridView导出为Excel文件 - amber lee zhao 使用HtmlAgilityPack批量抓取网页数据 OracleMembershipProvider与登录控件使用的技巧 - amber lee zhao 在ASP.NET中使用Quartz.net进行工作调度 结合OracleMembershipProvider开发简单的asp.net应用程序----配置web.config文件 C#版本的OracleMembershipProvider Double-Array Trie分词词典简述 [转] sharpICTCLAS 中在找出所有词组组合时的优化 .net下ICTCLAS原子分词和lucene的Token比较
使用EnterpriseLibrary插入Oracle CLOB数据
amber lee zhao · 2008-01-13 · via 博客园 - amber lee zhao

郁闷了很久,始终无法插入Oracle CLOB数据。网上搜索到的文章,多半是过时的方式,复杂容易出错。
偶然看到 Microsoft.Practices.EnterpriseLibrary.Data.Oracle  心中窃喜,EnterpriseLibrary想的挺周到,实现了Oracle的操作方式。继续寻找,看到了下面一个方法

AddParameter(OracleCommand command, string name, OracleType oracleType, int size, ParameterDirection direction, bool nullable, byte precision, byte scale, string sourceColumn, DataRowVersion sourceVersion, object value);

一看,有OracleType,这下好了,可以用OracleType.Clob了。
下面是实现的代码

            //连接数据库
            OracleDatabase db = (OracleDatabase)DatabaseFactory.CreateDatabase(Constant.DBNAME);
            
//插入信息的SQL。content的类型是CLOB
            string insertSql = "INSERT INTO article(content) VALUES (:content)";
            
//获得DbCommand对象
            OracleCommand dbCommand = (OracleCommand)db.GetSqlStringCommand(insertSql);

            
//为SQL中的变量赋值
            db.AddParameter(dbCommand, "content"OracleType.Clob, strContent.Length, ParameterDirection.Input, false00"", DataRowVersion.Default, strContent);  /*内容*/
             //执行操作
         
int affectRows = db.ExecuteNonQuery(dbCommand);