日期:2014-05-18  浏览次数:20745 次

如何通过程序访问目标网站

当点击查询按钮后,怎么让程序根据用户所选择的条件去访问这个网站 就是到这个网站去查询信息 http://www.lehecai.com/lottery/draw/  

后将所查询到的信息分析并存入自己的数据库中,后在程序中显示???


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace lettey
{
  public partial class Form1 : Form
  {
  public Form1()
  {
  InitializeComponent();
  }

  private void label1_Click(object sender, EventArgs e)
  {

  }

  private void Form1_Load(object sender, EventArgs e)
  {
  // TODO: 这行代码将数据加载到表“db1DataSet1.bind_number”中。您可以根据需要移动或移除它。
  this.bind_numberTableAdapter.Fill(this.db1DataSet1.bind_number);
  // TODO: 这行代码将数据加载到表“db1DataSet.bind_type”中。您可以根据需要移动或移除它。
  this.bind_typeTableAdapter.Fill(this.db1DataSet.bind_type);

  }

  private void button1_Click(object sender, EventArgs e)
  {
  string s1 = this.comboBox1.SelectedItem.ToString();
  string s2 = this.comboBox2.SelectedText.Trim();


  }
  }
}



这个源代码 请各位帮帮忙

------解决方案--------------------
我只能给你说个思路。。。挺麻烦的,有两种方式,
1,用WEBBROWSER 获取这个页面的HTML,然后用正则匹配
2,用WEBCLIENT 获取页面内容,然后用正则匹配