字段该用什么类型?怎么保存和读取?
解决方案 »
- image控件怎样将改扩展名后的图片文件装入?
- 能不能写到多个文件当中?
- quickreport 里的QRDBText绑定的字段值如果是null或为0就不在QRDBText上不显示任何东西怎么实现
- access我在从另一个表里取数据出问题了,救我啊!
- 如何在用PrintDBGridEh1打印DBGrideh1的时候能在打印的最后加上系统的日期!
- 如何从txt将数据像从access中一样读出来
- 那位高手帮帮忙!!
- 如何设置在combobox里只能输入数值型数据(整数和实数),其他数据无法输入?
- debug.exe重定向问题
- 文本文件可不可以一边读一边写?
- 紧急求救,Delphi7调用C#(Web Service)出现莫名其妙的错误!!!在线等待
- 小弟求MsComm串口通信的简单测试例子!在线。高手帮忙!
var
aFile:TADOBlobStream;
begin
ADOQuery.Edit;
aFile:=TADOBlobStream.Create((ADOQuery.Fieldbyname(FieldName) as TBlobField),bmWrite);
if FileName = '' then
aFile.Truncate
else
aFile.LoadFromFile(filename);
aFile.free;
ADOQuery.Post; Application.MessageBox(pchar('保存成功'),pchar(Application.title),mb_ok+mb_iconinformation);
end;
procedure TForm1.Button1Click(Sender: TObject);var aa:string;
begin
if OpenDialog1.Execute then
aa:=OpenDialog1.FileName;
FileToDb(ADOQuery1,aa,'照片');end;字段用:OLE 对象
function FileFromDB(FieldName,outfile:string;ADOQuery:TADOQuery):boolean;
var
AFile:TADOBlobStream;
fileName:string;
i:integer;
begin //将QUERY控件ADOQuery中字段fieldName的内容作为BOLB类型字段保存到文件SavePath+preFileName+COUNT中去
result:=false;
with ADOQuery do
begin
if not eof then
begin
if (Fieldbyname(FieldName).isnull)or
(not (Fieldbyname(FieldName) is TBlobField)) then
//空内容或非二进制内容直接跳过
exit; AFile:=TADOBlobStream.Create((Fieldbyname(FieldName) as TBlobField),bmRead);
AFile.SaveToFile(outfile);
result:=true;
AFile.free;
end;
end;
end; //忘了说:代码是人家高手写的,我是COPY来的