如何使用网格视图复选框将选定的行放入另一个数据库 [英] how to get selected rows into another data base using grid view check boxes

查看:58
本文介绍了如何使用网格视图复选框将选定的行放入另一个数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
我想将选定的行从一个数据库知道要排入网格,我该怎么做?您可以指导我还是摘录
我试图删除,但我想插入另一个表

Hello,
I want to get selected rows one database to grid I need to know , how to do can u guide me or snippets
I have tried to delete but I want to insert another table

protected void btnDelete_Click(object sender, EventArgs e)
{
    //Loop through all the rows in gridview
    foreach(GridViewRow gvrow in gvUserDetails.Rows)
    {
        //Finiding checkbox control in gridview for particular row
        CheckBox chkdelete = (CheckBox)gvrow.FindControl("chkdelete");
        //Condition to check checkbox selected or not
        if(chkdelete.Checked)
        {
            //Getting UserId of particular row using datakey value
            int usrid = Convert.ToInt32(gvUserDetails.DataKeys[gvrow.RowIndex].Value);
            objUsers.DeleteParameters["UserId"].DefaultValue = usrid.ToString();
            objUsers.Delete();
        }
    }
}


在这里我该怎么做才能插入另一个表数据必须是克隆

[edit]引入了C#代码的预标记,将我的内容...以HTML格式未选中.已纠正大写和拼写-PES [/edit]


here what can I do to insert another table data must be clone

[edit]Pre tag for C# code introduced, Treat my content ... as HTML unchecked. Capitalization and spelling corrected - PES[/edit]

推荐答案

如果据我了解,您希望将已删除的值保存到另一个表中
然后,在存储过程中,您可以在从原始表中删除记录的同时进行处理..然后,首先插入到新表中,然后从原始表中删除
If It is my understanding that you want to save the deleted value in to another table
Then in the Store procedure you can handle it .. while deleting the record from the original table .. then 1st insert to the new table then delete from the Original table


这篇关于如何使用网格视图复选框将选定的行放入另一个数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆