日期:2014-05-19  浏览次数:20542 次

简单~~~~~~~~~~~~大家帮我看看 那里出现问题了....在线等...马上给分~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
protected   void   button1(object   sender,   EventArgs   e)
        {
              string     id   =   Request.QueryString[ "id "].ToString();
                OleDbConnection   myconn   =   db.createconnection();
                myconn.Open();
                string   sql   =   "Update     in_user   Set   email=@email   where   id=@id ";
                OleDbCommand   updatecmd   =   new   OleDbCommand(sql,   myconn);
                updatecmd.Parameters.Add( "@id ",   OleDbType.Integer,   16);
                updatecmd.Parameters[ "@id "].Value   =   id;
                Response.Write(id);


                        updatecmd.Parameters.Add( "@email ",   OleDbType.VarChar,16);  
                        if   (CheckBox1.Checked)
                        {   updatecmd.Parameters[ "@email "].Value   =   "vfdfgfdg ";   }
                        else
                        {   updatecmd.Parameters[ "@email "].Value   =   "wssass ";   }

                        updatecmd.ExecuteNonQuery();
                        myconn.Close();

                                      }
   


就是怎样都update不了   email   字段..   Request.QueryString[ "id "].ToString();能传到值..数据库   也有这个值的   记录

------解决方案--------------------
你还是自己设置断点跟踪一下吧
------解决方案--------------------
代码没有什么问题,
建议你换一个字段来更新试试.
email参数的赋值这样写,觉得要好些吧,个人意见:
string email;
if (CheckBox1.Checked)
{ email = "vfdfgfdg "; }
else
{ email = "wssass "; }
updatecmd.Parameters.Add( "@email ", OleDbType.VarChar,16);
updatecmd.Parameters[ "@email "].Value = email;
------解决方案--------------------
if (!IsPostBack)
{
//your code here
}
------解决方案--------------------
冲二裤杈只差两分!
------解决方案--------------------
我来迟到了,要不我也得点分,郁闷
------解决方案--------------------
jf 可以吧