代码 第一个页面的
											using System;
using System.Collections.Generic;
using 
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace WindowsApplication4
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            string conn = "server=.; database=pubs; uid=sa; pwd=sa;";
            SqlConnection con = new SqlConnection(conn);
            try
            {
                con.Open();
                string strsql = "select * from jobs";
                SqlDataAdapter ada = new SqlDataAdapter(strsql,con);
                DataSet objset = new DataSet();
                ada.Fill(objset);
                this.dataGridView1.DataSource = objset.Tables[0].DefaultView;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            Form2 fm = new Form2(this.dataGridView1);
            fm.ShowDialog();
        }
    }
}