现有两个窗体,form1和form2,from1上有一个表格,显示数据库中数据,一个添加按钮,点添加后弹出form2,录入添加数据,点form2的确定后,数据填入数据库,同时form1上的表格更新现在的问题是,每次添加新数据后,更新from1的表格显示数据时,我是重新读取数据库查询一次,当数据很多时,每次录入完成更新的时间都比较长,请教各位有什么好的更新办法么?代码如下:
 string strConn = "data source=(local);integrated security=true;persist security info=False;initial catalog=SDJJ";
        SqlConnection myConnection;
        SqlDataAdapter sda;        private void Form1_Load(object sender, EventArgs e)
        {
            string str = "select * from table1 x,table2 y where x.ID=y.ID";
            myConnection = new SqlConnection(strConn);
            sda = new SqlDataAdapter(str, myConnection);
            DataTable dt = new DataTable();
            sda.Fill(dt);
            dataGridView1.DataSource = dt;
        }        private void button_Add_Click(object sender, EventArgs e)
        {
            Form2 fr=new Form2();
            if (fr.ShowDialog() == DialogResult.OK)
            {
                string str = "select * from table1 x,table2 y where x.ID=y.ID";
                myConnection = new SqlConnection(strConn);
                sda = new SqlDataAdapter(str, myConnection);
                DataTable dt = new DataTable();
                sda.Fill(dt);
                dataGridView1.DataSource = dt;            }
        }