使用C#在asp.net中进行sql更新查询 [英] sql update query in asp.net with C#
本文介绍了使用C#在asp.net中进行sql更新查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我对此有疑问. .我想通过更新一些rows.so来加载gridview.所以使用哪个查询?..
我在网格视图中对加载行使用选择查询,也使用更新查询来更新特定的行.但是,每当我运行页面更新查询时就会触发,但它无法更新行.当我刷新页面时,它会更新行. class ="h2_lin">解决方案
使用gridview1.DataBind();再次显示变化.如
字符串 strup = " ; SqlCommand cmdup = 新 SqlCommand(strup,Db.GetConnection()); cmdup.Parameters.AddWithValue(" , Int32 .Parse(lblReqID.Text)); cmdup.ExecuteNonQuery(); GridView1.DataBind();
i have question that. . i want load gridview with updating some rows.so which query is used?..
i use select query for load rows in gridview and also use update query to updating particular row.but whenever i run page update query fired but it can''t update row.and when i refresh the page it updates rows.. .
解决方案
use gridview1.DataBind(); again to show the changes . as
string strup = "Update FileRequest set FileStatus='1' where id=@id"; SqlCommand cmdup = new SqlCommand(strup,Db.GetConnection()); cmdup.Parameters.AddWithValue("id",Int32.Parse(lblReqID.Text)); cmdup.ExecuteNonQuery(); GridView1.DataBind();
这篇关于使用C#在asp.net中进行sql更新查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文