龙
龙河
Unregistered / Unconfirmed
GUEST, unregistred user!
在表中有一个字段为图像类型,在增加一条纪录时,不能把图像存到数据库中。
我曾试用下面一段代码:
procedureTForm1.pictopenbtnClick(Sender:TObject);
begin
opendialog1.execute;
image1.picture.loadfromfile(opendialog1.filename);
end;
procedureTform1.Savebtnclick(sender:TObject);
var graphic1:TGraphic;
begin
graphic1:=TGraphic.Create;
graphic1.loadfromfile(opendialog1.filename);
table1.insert;
table1.fieldbyname(′name′).asstring:=edit1.text;
table1.fieldbyname(′telephon′).asstring:=edit2.text;
table1.fieldbyname(′address′).asfloat:=(edit3.text);
table1.fieldbyname(′zip′).asfloat:=(edit4.text);
table1.fields[4].assign(graphic1);
table1.post;
graphic1.free;
end;
但编译时graphic1:=TGraphic.Create;这句有错!请问把图像存到数据库中
需要那些控件?请详细些,最好附上源代码!小弟刚学Delphi,有许多问题要问,
只有50分送!
我曾试用下面一段代码:
procedureTForm1.pictopenbtnClick(Sender:TObject);
begin
opendialog1.execute;
image1.picture.loadfromfile(opendialog1.filename);
end;
procedureTform1.Savebtnclick(sender:TObject);
var graphic1:TGraphic;
begin
graphic1:=TGraphic.Create;
graphic1.loadfromfile(opendialog1.filename);
table1.insert;
table1.fieldbyname(′name′).asstring:=edit1.text;
table1.fieldbyname(′telephon′).asstring:=edit2.text;
table1.fieldbyname(′address′).asfloat:=(edit3.text);
table1.fieldbyname(′zip′).asfloat:=(edit4.text);
table1.fields[4].assign(graphic1);
table1.post;
graphic1.free;
end;
但编译时graphic1:=TGraphic.Create;这句有错!请问把图像存到数据库中
需要那些控件?请详细些,最好附上源代码!小弟刚学Delphi,有许多问题要问,
只有50分送!