怎样获取html表格中的数据,然后存入数据库?

解决方案 »

  1.   

    ovTable := WebBrowser1.OleObject.Document.all.tags('TABLE').item(0);
      StringGrid1.RowCount := ovTable.Rows.Length ;
      StringGrid1.ColCount := ovTable.Rows.Item(i).Cells.Length;  for i := 0 to (ovTable.Rows.Length - 1) do
      begin
        for j := 0 to (ovTable.Rows.Item(i).Cells.Length - 1) do
        begin
          StringGrid1.Cells[j,i] := ovTable.Rows.Item(i).Cells.Item(j).InnerText;
        end;
      end;
      

  2.   

    可以先把数据取时数据集dbgrideh
    ovTable := WebBrowser4.OleObject.Document.all.tags('TABLE').item(0);
        for i := 0 to (ovTable.Rows.Length - 1) do
        begin
          for j := 0 to (ovTable.Rows.Item(i).Cells.Length - 1) do
          begin
            Qry_money.Edit;
            Qry_money.FieldByName(Grid_money.Columns[j+2].FieldName).Value := ovTable.Rows.Item(i).Cells.Item(j).InnerText;
            Qry_money.Post;
          end;