var
loc_obj_stream : TMemorystream;
query1 : Tquery;
loc_obj_field : Tblobfield;
begin
loc_obj_stream := TMemoryStream.Create;
loc_obj_stream.LoadFromFile('c:/Book1.xls');
query1 := TQuery.Create(nil);
query1.DatabaseName := 'fszjz';
query1.RequestLive := true;
query1.Close;
query1.SQL.Clear;
query1.SQL.Add('select * from tablename');
query1.Open;
query1.Insert;
loc_obj_field := (query1.FieldByName('text1') as Tblobfield);
loc_obj_field.LoadFromStream(loc_obj_stream);
query1.Post;
end;
这是把文件存入数据库