在Gridview自定义模板中有个的textbox,旁边有个button,现在点击button按钮保存textbox输入的值到数据库
这是代码,现在是值保存不到数据库,是不是还要加点东西protectedvoidButton1_Click(objectsender,EventArgse){stringa...
这是代码,现在是值保存不到数据库,是不是还要加点东西
protected void Button1_Click(object sender, EventArgs e)
{
string a = string.Empty;
for (int i = 0; i < this.GridView1.Rows.Count; i++)
{
TextBox T = (GridView1.Rows[i].Cells[1].FindControl("TextBox1")) as TextBox;
a = T.Text;
string strSql = "update tb_User set Name=" +a;
}
} 展开
protected void Button1_Click(object sender, EventArgs e)
{
string a = string.Empty;
for (int i = 0; i < this.GridView1.Rows.Count; i++)
{
TextBox T = (GridView1.Rows[i].Cells[1].FindControl("TextBox1")) as TextBox;
a = T.Text;
string strSql = "update tb_User set Name=" +a;
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询