请教一下大家,怎么样才能把一个网页中的表格数据下载后保存到数据库中,如有代码,非常感谢

解决方案 »

  1.   

    比较简单的是用webbrowser控件。也有其它可用控件。不用控件也可以实现。如果需要别人给你写现成的代码,可能要支付一定费用。
      

  2.   

    TWebBrowser
    最近好多人在问这个问题啊
    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, OleCtrls, SHDocVw, StdCtrls, MSHtml;type
      TForm1 = class(TForm)
        wb1: TWebBrowser;
        Button1: TButton;
        procedure FormCreate(Sender: TObject);
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
    begin
            wb1.Navigate('http://localhost:12880/mtm/abc.htm');
    end;procedure TForm1.Button1Click(Sender: TObject);
    var
            doc: IHTMLDocument2;
            mTable: IHTMLTable;
            mRow: IHTMLTableRow;
            mCell: IHTMLElement;
            mElement: IHTMLElementCollection;
            i,j: integer;
    begin
            doc := wb1.Document as IHTMLDocument2;        mTable := doc.all.item('xxxx',0) as IHTMLTable;
            for i:=0 to mTable.rows.length-1 do
            begin
                    mRow := mTable.rows.item(i,0) as IHTMLTableRow;                for j:=0 to mRow.cells.length-1 do
                    begin
                            mCell := mRow.cells.item(j,0) as IHTMLElement;
                            showmessage(mCell.innerHTML);
                    end;
            end;
    end;end.
      

  3.   

    同意三楼  这个有什么难得 我现在做的如火纯青了  最好用idhttp  get  可以做成多线程我的程序 可批量下载 那速度搜搜的
      

  4.   

    不建议使用  webbrowser 用过的应该知道 
    争夺焦点问题 
    浪费更多的网络流量
    速度慢而且你想隐藏 它 还要有技巧  不能直接visible:=false;  webbrowser 不可见时  很多事件是无法触发的 
    建议 httpwatch+idhttp  天下无敌
      

  5.   

    IdHttp下载源码→用正则表达式提取数据→插入数据库。
      

  6.   

    idhttp不知道现在是不是炉火纯青了?