| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2334 人关注过本帖
标题:GridView数据更新问题
取消只看楼主 加入收藏
pietro
Rank: 1
等 级:新手上路
帖 子:54
专家分:0
注 册:2006-9-19
收藏
 问题点数:0 回复次数:1 
GridView数据更新问题

代码如下:

protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
string userID = this.GridView1.DataKeys[e.RowIndex].Values[0].ToString();
string Name = ((TextBox)this.GridView1.Rows[e.RowIndex].FindControl("txtb1")).Text;
Response.Write(Name);
SqlConnection con = new SqlConnection("server=.;database=login;uid=sa;pwd=;");
con.Open();
SqlCommand cmd = new SqlCommand("update login set userName='" + Name + "' where userID='" + userID + "'", con);
cmd.ExecuteNonQuery();
this.GridView1.EditIndex = -1;
this.GridViewToBind();
}



我想实现GridView数据更新,可是老更新不过来,红色标出来的部分打印出来发现是未编辑前的数据,重新输入到文本框里的数据不能显示出来,那位知道是怎么回事???

搜索更多相关主题的帖子: GridView 数据 con 
2006-11-19 22:52
pietro
Rank: 1
等 级:新手上路
帖 子:54
专家分:0
注 册:2006-9-19
收藏
得分:0 
不是吧   没有人能解决这个问题吗???
2006-11-21 16:39
快速回复:GridView数据更新问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011689 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved