? 急急急!!关于SQL SERVER里的IMAGE类型和ORCALE里的BLOBl类型!!!!

zxy1980 2003-10-16 07:57:49
sqlserver里有一个表的字段是image型,oracle里有个表的字段是blob型,想问用sql语句在delphi里面怎么样才可以把sqlserver里image型字段的内容插入到oracle里blob型字段呢?急,等待赐教 !!!!!!!!!!!!
...全文
51 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
chanet 2003-10-16
  • 打赏
  • 举报
回复
在delphi中的处理
对于lob字段而言,个人认为其使用比long类型有很大的灵活性,而且lob字段可以保存各类的数据,可以保存图片,大量的文字,现就clob跟blob两种类型加以说明,其中blob保存图片信息,clob保存大量文字。
exmple 6.
Create table test_table
(c_no number(1) not null,
c_blob blob,
c_clob clob,
constraint pk_test_table primary key (c_no));

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DBCtrls, Grids, DBGrids, DB, DBTables, ExtDlgs;

type
TForm1 = class(TForm)
Database1: TDatabase; //用于连接数据库
Table1: TTable; //获取表信息
DataSource1: TDataSource;
DBGrid1: TDBGrid;
DBMemo1: TDBMemo; //显示c_clob字段内容
DBImage1: TDBImage; //显示c_blob字段内容
Button1: TButton; //插入按钮
Button2: TButton; //保存按钮
Table1C_NO: TFloatField; //Tfiled
Table1C_BLOB: TBlobField;
Table1C_CLOB: TMemoField;
OpenPictureDialog1: TOpenPictureDialog; //从文件获取图片
OpenDialog1: TOpenDialog; //从文件获取文字
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin //插入操作
with Table1 do
begin
Insert; //将表状态置为插入状态
if OpenPictureDialog1.Execute then //获得图片信息
Table1C_BLOB.LoadFromFile(OpenPictureDialog1.FileName);
if OpenDialog1.Execute then //获得文字信息
Table1C_CLOB.LoadFromFile(OpenDialog1.FileName);
end;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin //提交插入内容
try
Table1.Post;
except
Application.MessageBox('错误发生','警告',0);
end;
end;

end.

注意:
openpiceturedilog只能打开dmp,ico,wmf等文件,事先需要将图片文件格式保存成这几类;
在文字字段不从文件获得时,可以手动输入
本例只是对lob字段的一个小小的探索,用法不当及需改正之处,还请多多指教。

注:本篇文章大部分例子均取自论坛,如有侵犯您的版权,请来信告知,我们会做相应处理。


注意:
openpiceturedilog只能打开dmp,ico,wmf等文件,事先需要将图片文件格式保存成这几类;
在文字字段不从文件获得时,可以手动输入

17,082

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧