大吓是这样的!
我用一个datagrid 与一个table表关联了!现在就是用户在datagrid 上进行一系列的修改!比如:有增加,删除,修改,!只要用户点一下边上的保存按钮就可以将这些修改全部存入数据库!我要怎么写这个保存函数啊!请大吓指点迷津!

解决方案 »

  1.   

    遍历datagrid,并对数据库进行更新
      

  2.   

    Grid_UpdateCommand事件里实现最简单
    {
    string strNum = ((TextBox)e.Item.Cells[4].Controls[0]).Text.Trim();
    string strsql = "update table set num = '"+strNum+"'";
    //执行SQL语句
    }
      

  3.   

    Grid_UpdateCommand事件里实现最简单
    {
    string strNum = ((TextBox)e.Item.Cells[4].Controls[0]).Text.Trim();
    string strsql = "update table set num = '"+strNum+"'";
    //执行SQL语句
    }