• λ我爱Aspx >> Asp.Net >> 初谈ADO.NET中利用DataAdapter进行数据操作
  • 初谈ADO.NET中利用DataAdapter进行数据操作

  • :aspxer  Դ:5iaspx  :2007-8-1 13:14:57  ؼ:.net,数据
  • myAda.Fill(mySet, "UserInfo");

    }

    catch (SqlException ex)

    {

    MessageBox.Show(ex.ToString());

    }

    finally

    {

    myCon.Close();

    }

    dataGridView1.DataSource = mySet.Tables["UserInfo"];

    }

    private void bt_Update_Click(object sender, EventArgs e)

    {

    try

    {

    //将更改的数据更新到数据表里

    myAda.Update(mySet.Tables[0].GetChanges());

    MessageBox.Show("数据更新成功!");

    //DataTable接受更改,以便为下一次更改作准备

    mySet.Tables[0].AcceptChanges();

    }

    catch (SqlException ex)

    {

    ex.ToString();

    }

    }

    private void bt_Delete_Click(object sender, EventArgs e)

    {

    //从DataTable中删除当前选中的行

    mySet.Tables[0].Rows[dataGridView1.CurrentRow.Index].Delete();

    if (MessageBox.Show("确定要删除当前行数据?", "", MessageBoxButtons.OKCancel) == DialogResult.OK)

    Ҷƪл˵?
  • һƪPhotoshop精彩特效:玻璃砖墙材质图
    һƪ使Div内内容可编辑