用datagrid添加一个新的rceord [英] add a new rceord with datagrid

查看:69
本文介绍了用datagrid添加一个新的rceord的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用datagridview在数据库中添加新记录.
我使用Visual Studio2010.
我需要在vb.net或c#中.
请帮帮我.
Thankyou

how can i add a new record in database with datagridview.
i work with visual studio 2010.
i need in vb.net or c#.
please help me.
thankyou

推荐答案


检查此
在ASP.NET 2.0中可编辑GridView [ ^ ]
http://www.c-sharpcorner.com/uploadfile/anjudidi /example-of-datagrid-in-Asp-Net/ [ Google [
Hi ,
Check this
Editable GridView in ASP.NET 2.0[^]
http://www.c-sharpcorner.com/uploadfile/anjudidi/example-of-datagrid-in-Asp-Net/[^]
You will find what you looking for
Google[^]
Best Regards
M.Mitwalli


要从Grid View添加数据,在Grid Footer中具有输入控件,并将ShowFooter设置为Ture
并让Button提供通用名称,在RowCommond事件中使用以下逻辑..
To Add data from Grid View have input controls in Grid Footer and set ShowFooter to Ture
and have Button give Commond Name, In RowCommond event use following logic..
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
    if (e.CommandName == "AddItem")
    {
        // find the required controls from the footer item
        Control controlRefName = GridView1.FooterRow.FindControl("controlID") as Control;
        .
        .
  
        // Do your insert logic here..
    }
}


这篇关于用datagrid添加一个新的rceord的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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