将gridview记录保存在数据库中 [英] Save the gridview recor in database

查看:61
本文介绍了将gridview记录保存在数据库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Gridview如下





学生ID学生姓名

1 sam

2 suresh

3 rajesh





i希望在数据库中保存上面的gridview记录。 />


我怎样才能在asp.net中使用c#。



问候,

narasiman P.

Gridview as follows


Student id student name
1 sam
2 suresh
3 rajesh


i want to save the above gridview record in database.

for that how can i do in asp.net using c#.

regards,
narasiman P.

推荐答案

按一下按钮,点击那个Wright:



foreach (GridView.Rows中的GridViewRow行)

{

Label label1 =(Label)row.FindControl(Label1);

Label label2 =(标签)row.FindControl(Label2);





写入Sql命令插入此处

}
Take a button and on click of that Wright:

foreach (GridViewRow row in GridView.Rows)
{
Label label1= (Label )row.FindControl("Label1 ");
Label label2= (Label )row.FindControl("Label2 ");


Write Sql command for insertion here
}


参考:

HTTP: //www.c-sharpcorner.com/blogs/8387/insert-data-from-gridview-to-database.aspx [ ^ ]

如何将数据从GridView保存到数据库? [ ^ ]

http://www.aspsnippets.com/Articles/Add-record-to-Database-using-ASP.Net-GridView-EmptyDataTemplate-and-FooterTemplate.aspx [ ^ ]

T.他可能会帮忙。
Refer:
http://www.c-sharpcorner.com/blogs/8387/insert-data-from-gridview-to-database.aspx[^]
How I can save the data from GridView to the database?[^]
http://www.aspsnippets.com/Articles/Add-record-to-Database-using-ASP.Net-GridView-EmptyDataTemplate-and-FooterTemplate.aspx[^]
This may help.


请看下面的链接:

如何使用C#中的SqlParameter将多条记录插入数据库 [ ^ ] < br $> b $ b

插入数据库中的多个记录 [ ^ ]
Please have a look on the bellow link :
How to insert multiple records into database with SqlParameter in C#[^]

insert multiple records at once in database[^]


这篇关于将gridview记录保存在数据库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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