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

推荐订阅源

V
Vulnerabilities – Threatpost
U
Unit 42
F
Fortinet All Blogs
aimingoo的专栏
aimingoo的专栏
P
Proofpoint News Feed
F
Full Disclosure
月光博客
月光博客
Engineering at Meta
Engineering at Meta
博客园_首页
The Register - Security
The Register - Security
G
Google Developers Blog
The Cloudflare Blog
博客园 - Franky
K
Kaspersky official blog
A
Arctic Wolf
Scott Helme
Scott Helme
C
Cisco Blogs
Hugging Face - Blog
Hugging Face - Blog
C
Check Point Blog
NISL@THU
NISL@THU
AI
AI
D
DataBreaches.Net
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Stack Overflow Blog
Stack Overflow Blog
Project Zero
Project Zero
The GitHub Blog
The GitHub Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
量子位
Vercel News
Vercel News
T
Tor Project blog
P
Privacy International News Feed
D
Docker
I
Intezer
L
LangChain Blog
P
Proofpoint News Feed
Security Latest
Security Latest
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Threatpost
博客园 - 聂微东
AWS News Blog
AWS News Blog
Martin Fowler
Martin Fowler
P
Privacy & Cybersecurity Law Blog
V
V2EX
Last Week in AI
Last Week in AI
C
Cybersecurity and Infrastructure Security Agency CISA
The Hacker News
The Hacker News
T
Tenable Blog
Blog — PlanetScale
Blog — PlanetScale
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tailwind CSS Blog

博客园 - surprise

首次使用Ajax 大家看一下这是.net的漏洞还是程序有问题,我一时也没搞清,只知道这问题挺怪的 - surprise - 博客园 一道Sql语句问题? 运用C#处理lob数据类型 (Oracle) 介绍一种Web上打印技术 Sql Server 中image类型迁移到Oracle 中Blob类型出现图片显示不出来,why????请博客们帮忙 windows 2000下最多可以承受有多大容量外存???? 如何使用一个不错的图表组件WebChart(免费) 太爽了博客园有论坛了? 谁能帮我 WebChart组件的使用??? 能不能在博客园内建立一块开源区呀??? 如何在类库项目中添加配置文件?????? 中文版的hibernate pdf教程下载 用Nhibernate怎么实现数据的添加、删除、修改简单程序 介绍Nhibernate网站 俺现在碰到一些问题请大家帮忙??? 俺现在有个程序需要UTC转换为当地时间,哪位大虾会呀??? 我想问一下NHibernate的问题??? 10.1我发现一个非常好的架构NHibernate,我想和大家一起研究
在C#中存储Blob类型的数据,
surprise · 2005-04-19 · via 博客园 - surprise

我现在在Oracle中写了个存储过程如下:
create or replace procedure update_student_clob(
     v_cmid     in number,     --表的主键ID
     v_geometry  in blob --新的图形对象
    )
is
    lobloc  blob;
     query_str  varchar2(1000);
begin
--取出blob对象
   query_str :='select SPHOTOfrom student where STUDENTID= :id for update ';
   EXECUTE IMMEDIATE query_str INTO lobloc USING v_cmid;
   --更新
   dbms_lob.write(lobloc, utl_raw.length(v_geometry),1, v_geometry);
 
   commit;
end;

在C#中的代码部分如下:
1.数据层
public override void  RunProcedure(string storedProcName,OracleParameter[] parameters)

  {
   cmd.CommandText=storedProcName;//声明存储过程名

   cmd.CommandType=CommandType.StoredProcedure;

   foreach(OracleParameter parameter in parameters)

   {
    cmd.Parameters.Add(parameter);
   }

   cmd.ExecuteNonQuery();//执行存储过程

  }

2.商业层
//用于存储照片,StuEntity 为实体类
public void AddStudent(StuEntity p_Entity)
  {
   DataAccess.DBOperator m_Ora = DBOperator.CreateKgInstance();
   try
   {
    //fs为创建文件流
    FileStream fs=new FileStream(p_Entity.photo,FileMode.OpenOrCreate);
    //创建了二进制数组
    byte[] blob = new byte[fs.Length];
    fs.Read(blob, 0, blob.Length);
    fs.Close();
    //studid为主键
    string m_Sql="update student set sphoto=empty_blob() where STUDENTID=1";
    m_Ora.Execute(m_Sql);
    SpExeFor(1,blob);
   }
   catch(Exception ex)
   {
    throw ex;
   }
   finally
   {
    m_Ora.Close();
   }
  }

  public void SpExeFor(int p_Studid,byte[] p_Blob)

  {
   DataAccess.DBOperator m_Ora = DBOperator.CreateKgInstance();
   try
   {
   //存储过程的参数声明
   OracleParameter[] parameters={
            new OracleParameter("v_cmid",OracleType.Int32),
            new OracleParameter("v_geometry",OracleType.Blob,p_Blob.Length),
           };
    parameters[0].Value=p_Studid;
    parameters[1].Value=p_Blob;
    m_Ora.RunProcedure("update_student_clob",parameters);
   }
   catch(Exception e)
   {
    throw e;
   }
   finally
   {
    m_Ora.Close();
   }
  }