1.比如两张表都有一个字段'id',想从两张表通过'id'连接查询
2.两张结构一样的表,怎么进行合并(考虑'id'重复和不重复两种情况)
3.怎样才能不通过向导把Excel 表倒到Accsee 等数据库中,就是用写代码来实现谢谢!!!

解决方案 »

  1.   

    给你个控制Excel的例子
    procedure TfrmSG.Button1Click(Sender: TObject);  //uses Excel2000 , ComObj
    var
      pc_i:integer;
      xlapp,sheet: variant;
      WBK: OleVariant;
    begin
      xlapp := createoleobject('excel.application');
      xlapp.visible := True;      //Excel是否可见
      if Trim(Edit1.Text)='' then
      begin
        Application.MessageBox('文件名不能为空','警告',MB_OK);
        Exit;
      end;
      WBK := xlapp.workbooks.Open(Edit1.Text);
      sheet := xlapp.workbooks[1].worksheets['sheet1'];
      sheet.Cells.SpecialCells(XlCellTypeLastCell,EmptyParam).Activate;  //showmessage(IntToStr(xlapp.ActiveCell.Row));
      //showmessage(IntToStr(xlapp.ActiveCell.Column));
      //excelworksheet2.UsedRange[1].Rows.Count));
      //excelworksheet2.UsedRange[1].Columns.Count));
      pc_i:=1;
      Edit2.Text := sheet.cells[pc_i,1];     //写入的话用 sheet.cells[pc_i,1] := Edit2.Tex;
      WBK.Close(SaveChanges := True);
      xlapp.Quit;
    end;
      

  2.   

    1.比如两张表都有一个字段'id',想从两张表通过'id'连接查询
    2.两张结构一样的表,怎么进行合并(考虑'id'重复和不重复两种情况)
    用ado連接Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\pdsBom.xls;Extended Properties="Excel 8.0;IMEX=1";Persist Security Info=False
    不知道能不能用union和join﹐你試一下3.怎样才能不通过向导把Excel 表倒到Accsee 等数据库中,就是用写代码来实现
    http://www.delphibbs.com/delphibbs/dispq.asp?lid=1691966