//例子如下:可以导入任意类型的文件
procedure TFm_Treaty_Add.SpeedButton11Click(Sender: TObject);
begin
ADOCommand1.CommandText:='Insert Into User_Document (文件名,说明文字,文书,属性) Values
文件名,:说明文字,:文书,:属性)';
ADOCommand1.Parameters.ParamByName('文件名').Value:=Lb_FileName.Caption;
ADOCommand1.Parameters.ParamByName('说明文字').Value:=Edit1.Text;
if RadioButton1.Checked then
ADOCommand1.Parameters.ParamByName('属性').Value:=Form1.User_Code;
if RadioButton2.Checked then
ADOCommand1.Parameters.ParamByName('属性').Value:=0;
//这句是你要的吧
ADOCommand1.Parameters.ParamByName('文书').LoadFromFile(OpenDialog1.FileName,ftBlob);//(ADOBS,ftBlob);
try
ADOCommand1.Execute;
Application.MessageBox('文档已成功导入数据库。','导入完成',Mb_ok+Mb_IconInformation);
Close;
except
on E:Exception do
begin
Application.MessageBox(PChar('操作遇到错误被终止,系统返回的错误信息如下:'+#13+#13+E.Message) ,'操作失败',Mb_OK+Mb_IconInformation);
end;
end;
end;
//哈哈.回答第三次这个问题了