如题请大家帮帮忙.

解决方案 »

  1.   


    procedure TForm1.Button3Click(Sender: TObject);var
    I: Integer;
    Str,dateT: String;
    StrList: TStringList;
    isSave:boolean;
    title:string;
    begin
    try
      if savedialog1.Execute then
      begin
      isSave:=true;
      if FileExists(savedialog1.FileName) then
        if idno=messagebox(handle,'文件已經存在,是否繼續保存?','提示',mb_iconstop+mb_yesno) then
        begin
          issave:=false;
        end;
     if issave then
      begin
      StrList := TStringList.Create;
       with dbgrid1 do
       begin
          title:='';
          for i:=0 to Columns.Count-1 do
          begin
            title:=title+Columns[i].Title.Caption+#9;
          end;
         StrList.Add(title);
       end;
      with ADOQuery1  do
      begin
        First;
        while not Eof do
        begin
          Str := '';
          for I := 0 to FieldCount-1 do
          begin
              Str := Str + Fields[i].asString + #9;
          end;
          StrList.Add(Str);
          Next;
        end;
       StrList.SaveToFile(savedialog1.FileName);
       messagebox(handle,'數據保存成功.','提示',MB_OK+MB_ICONINFORMATION);
       end;
       end;
       end;
    finally
        Freeandnil(StrList);
     end;
    end;
      

  2.   

    是不是数据库表是ACCESS
    要把日期转为字符再导出
      

  3.   

    用formatdatetime函数格式化一下