下面一段保存程序,在TSShapeSaveFile有关键的语句  STList.SaveToFile(FileName);可以将结果保存成文本文件,我想保存到数据库里比如:Access,应如何修改此程序?多谢各位大侠!
procedure TForm1.TSShapeSaveFile(FileName: string);
var
  i: integer;
  STList: TStrings;
begin
  STList := TStringList.Create;
  try
    STList.Clear;
    for i := 0 to FIndexOfShape do begin
      if FSomeShape[i] <> nil then begin
        STList.Add('ShapeType='+ Shape2str(FSomeShape[i].shape));
        STList.Add('x='+ inttostr(FSomeShape[i].Left));
        STList.Add('y=' + inttostr(FSomeShape[i].Top));
        STList.Add('width=' + inttostr(FSomeShape[i].Width));
        STList.Add('height=' + inttostr(FSomeShape[i].Height));
     end;
    end;
    STList.SaveToFile(FileName);
  finally
    STList.Destroy;
  end;
end;procedure TForm1.SaveFileClick(Sender: TObject);
begin
    SaveDialog1.Execute;
    if SaveDialog1.FileName = '' then begin
      exit;
    end;
    TSShapeSaveFile(SaveDialog1.FileName);
end;

解决方案 »

  1.   

    for i := 0 to FIndexOfShape do begin
          if FSomeShape[i] <> nil then begin
    with table1 do
    begin
     append;
     fieldbyname['ShapeType'].value:=Shape2str(FSomeShape[i].shape);
     fieldbyname['x'].value:=FSomeShape[i].Left;
     fieldbyname['y'].value:=FSomeShape[i].Top;
     fieldbyname['width'].value:=FSomeShape[i].Width;
     fieldbyname['height'].value:=FSomeShape[i].Height;
    end;
    post;
        end;
      

  2.   

    firetoucher(风焱) 都出马了还没搞定吗
      

  3.   

    procedure TForm1.TSShapeSaveDB(FileName: string);
    var
      i: integer;
      STList: TStrings;
    begin
      STList := TStringList.Create;
      ms := TMemoryStream.Create;
      try
        STList.Clear;
        for i := 0 to FIndexOfShape do begin
          if FSomeShape[i] <> nil then begin
            STList.Add('ShapeType='+ Shape2str(FSomeShape[i].shape));
            STList.Add('x='+ inttostr(FSomeShape[i].Left));
            STList.Add('y=' + inttostr(FSomeShape[i].Top));
            STList.Add('width=' + inttostr(FSomeShape[i].Width));
            STList.Add('height=' + inttostr(FSomeShape[i].Height));
         end;
        end;
        STList.SaveToStream(ms);
        Table1.Append;//或者Talbe1.Edit;看情况而定
        TBlobField(Table.FieldbyName('fName')).LoadFromStream(ms);
        Talbe1.Post;
      finally
        ms.Free;
        STList.Destroy;
      end;
    end;
      

  4.   

    搞定!多谢大家!firetoucher(风焱)的fieldbyname['x']应为fieldbyname('x')。