是textbox里的值不变还是数据库里的值不变
解决方案 »
- GridView中每行后面有个LinkButton的编辑按钮,怎么提取主键
- 求个 手机发送短信的程序
- splitContainer 中设置 右边PANEL的宽,怎么设置?我点关闭右边PANEL的宽为0
- 在线等,如何定义一个变量表示类Pen的DashStyle?
- 本人初学c#,写了这段代码,总是出现"索引超出了数组界限",希望高手指教!
- 请教
- 怎样来写一个正则表达式,<td></td> 和 <TD></TD> 都可以匹配,也就是说遇上哪一种都返回。
- 关于DataGridView的分页和ComBobox绑定!
- 高手请进,是不是C#的Bug,我的方法为什么只能够传递32的参数?高分相送!!!!
- 什么叫“引用的程序集没有强名称”?——在线等,急!
- 简单问题,答完给分
- Web Server的问题?
如果是数据库里的值不变,可能是你没有正确的提交。
弄清这两个问题,找原因就要容易得多了。
while(reader1.Read())
{
this.TextBox1.Text=reader1.GetString(0)
}
保存:
string strupdate="update Employee_Info set posi=@posi where sysno="+sysno;
SqlCommand strupdatecmd=new SqlCommand(strupdate,strupdateconn);
strupdatecmd.Parameters.Add(new SqlParameter("@posi",SqlDbType.NVarChar,30));
strupdatecmd.Parameters["@posi"].Value=TextBox1.Text;
strupdatecmd.Connection.Open();
try
{
strupdatecmd.ExecuteNonQuery();
Response.Write("OK");
}
catch
{
Response.Write("error"); }
finally
{
strupdatecmd.Connection.Close();
}strupdatecmd.Parameters["@posi"].Value=TextBox1.Text;
我猜想,你textbox跟本就没有和数据库链上,因为你数据没有传给服务器端!
if(!IsPostBack)
{
sqlDataAdapter1.Fill(dataSet1,"表名");
DataGrid1.DataBind();
}
zag(急弯) 是指页面刷新呀!