使用C#将blob插入Oracle [英] Using C# to insert blob into Oracle

查看:226
本文介绍了使用C#将blob插入Oracle的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设置了一个包含blob字段的Oracle表。如何使用C#和ADO.net将

数据插入此字段?

解决方案

Chris,


Oracle的提供程序应将该字段表示为字节数组。你b $ b应该能够为数据集中的这个字段分配一个新的字节数组,然后

然后通过即席查询或存储过程更新字段,比如

你会在数据库中获得任何其他价值。


希望这会有所帮助。

-

- Nicholas Paldino [.NET / C#MVP]

- mv*@spam.guard.caspershouse.com


" Chris Fink" < CH ******** @ gmail.com>在消息中写道

新闻:Oo ************** @ TK2MSFTNGP14.phx.gbl ...

我已经设置了Oracle包含blob字段的表。如何使用C#和ADO.net将
数据插入此字段?



如何将C#字符串转换为一个字节数组?我使用哪个类,

StreamReader,StringReader等?感谢任何示例代码!


Nicholas Paldino [.NET / C#MVP]" < mv*@spam.guard.caspershouse.com>写在

消息新闻:eT ************** @ TK2MSFTNGP10.phx.gbl ...

Chris,
Oracle提供程序应将该字段表示为字节数组。
您应该能够在数据集中为此字段分配一个新的字节数组,然后通过即席查询或存储过程更新字段,只需
就像您一样数据库中的其他值。

希望这会有所帮助。

-
- Nicholas Paldino [.NET / C#MVP]
- mv*@spam.guard.caspershouse.com

Chris Fink < CH ******** @ gmail.com>在消息中写道
新闻:Oo ************** @ TK2MSFTNGP14.phx.gbl ...

我已经设置了一个Oracle表,其中包含一个blob字段。如何使用C#和ADO.net将
数据插入此字段?




克里斯,


这取决于字符串的格式。它是十六进制,还是base64

编码,还是别的什么?

-

- Nicholas Paldino [.NET / C#MVP ]

- mv*@spam.guard.caspershouse.com

" Chris Fink" < CH ******** @ gmail.com>在留言中写道

新闻:%2 **************** @ TK2MSFTNGP15.phx.gbl ...

怎么做我将C#字符串转换为字节数组?我使用哪个类,StreamReader,StringReader等?感谢任何示例代码!

Nicholas Paldino [.NET / C#MVP]" < mv*@spam.guard.caspershouse.com>在消息新闻中写道
:eT ************** @ TK2MSFTNGP10.phx.gbl ...

Chris,
Oracle提供程序应将字段表示为字节数组。


应该能够在数据中为此字段分配新的字节数组设置,
然后
然后通过即席查询或存储过程更新字段,只需


你可以在其中任何其他值数据库。

希望这会有所帮助。

-
- Nicholas Paldino [.NET / C#MVP]
- mv*@spam.guard.caspershouse.com

Chris Fink < CH ******** @ gmail.com>在消息中写道
新闻:Oo ************** @ TK2MSFTNGP14.phx.gbl ...

>我已经设置了一个Oracle表包含blob字段。如何插入>使用C#和ADO.net进入此字段的数据?
>
>





I have setup an Oracle table which contains a blob field. How do I insert
data into this field using C# and ADO.net?

解决方案

Chris,

The provider for Oracle should represent the field as a byte array. You
should be able to assign a new byte array to this field in a data set, and
then update the field through an ad-hoc query or stored procedure, just like
you would any other value in the database.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Chris Fink" <ch********@gmail.com> wrote in message
news:Oo**************@TK2MSFTNGP14.phx.gbl...

I have setup an Oracle table which contains a blob field. How do I insert
data into this field using C# and ADO.net?



How do I convert a C# string into a byte array? Which class do I use, the
StreamReader, StringReader, etc? Any sample code is appreciated!

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:eT**************@TK2MSFTNGP10.phx.gbl...

Chris,

The provider for Oracle should represent the field as a byte array. You should be able to assign a new byte array to this field in a data set, and
then update the field through an ad-hoc query or stored procedure, just like you would any other value in the database.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Chris Fink" <ch********@gmail.com> wrote in message
news:Oo**************@TK2MSFTNGP14.phx.gbl...

I have setup an Oracle table which contains a blob field. How do I insert data into this field using C# and ADO.net?




Chris,

It depends on the format of the string. Is it in hex, or is it base64
encoded, or something else?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Chris Fink" <ch********@gmail.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...

How do I convert a C# string into a byte array? Which class do I use, the
StreamReader, StringReader, etc? Any sample code is appreciated!

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote
in
message news:eT**************@TK2MSFTNGP10.phx.gbl...

Chris,

The provider for Oracle should represent the field as a byte array.


You

should be able to assign a new byte array to this field in a data set,
and
then update the field through an ad-hoc query or stored procedure, just


like

you would any other value in the database.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Chris Fink" <ch********@gmail.com> wrote in message
news:Oo**************@TK2MSFTNGP14.phx.gbl...

>I have setup an Oracle table which contains a blob field. How do I insert > data into this field using C# and ADO.net?
>
>





这篇关于使用C#将blob插入Oracle的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆