float newItem = (float)Convert.ToSingle(str);                    string strsql = "update Userinfo set Balance ="newItem" where Userid="+Userid;  
            DBUser.executeNonQuery(strsql);
            gvUser.EditIndex=-1;
            bindgvUser();我我要传浮点型的参数,修改数据库 Balance的数据 但一直都插不进去数据,想问问那个SQL语句写对了么?update Userinfo set Balance ="newItem" where Userid="+Userid;  

解决方案 »

  1.   

    你这样不报错??
    至少得这样吧:"update Userinfo set Balance ="+str+" where Userid="+Userid;
    另外上面这句是拼字符串所以都应该是string型 newItem直接用str代替就行了
      

  2.   

    ???这样应该编译都不过吧?应该是
    string strsql = "update Userinfo set Balance =" + newItem + "where Userid="+Userid; 
      

  3.   

    这样试试看:
    string strsql = "update Userinfo set Balance ="+newItem+" where Userid="+Userid;  
      

  4.   

    可能还需要这样,看你的userid是不是字符型数据了:
    string strsql = "update Userinfo set Balance ="+newItem+" where Userid='"+Userid+"'";