C#和SQL
SQL code:
update users set user_money='100' where user_id=1
我上设计器中执行上面的语句就成功.但是我的代码如下
C# code:
public int Deposit(int userid, int money)
{
UserVO uservo = new UserVO(userid);
float moneySum = Convert.ToSingle(money.ToString()) + uservo.userMoney;
string cmdText = "update users set user_money='" + moneySum + "' where user_id=" + userid;
int flag = 0;
flag = connDB.Flag(cmdText);
return flag;
}
为何没有任何反应,也不提示错误.但返回受影响行数为0;
请指教.
string cmdText = "update users set user_money=" + moneySum + " where user_id=" + userid;
顶
顶
string cmdText = "update users set user_money="+ moneySum +" where user_id=" + userid;
字段什么类型
user_money是浮点性
user_money是浮点性的则单引号去掉!!
string cmdText = "update users set user_money=" + moneySum + " where user_id=" + userid;
string cmdText
= "update users set user_money='" + moneySum + "' where [user_id]=" + us
相关问答:
在数据库中有张表,有id,name两列,id 是主键,没有设置自增属性,在程序中取出这张表放入datatable,在这个datatable中插入一条记录,当更新数据库时提示id列不能为空,请问该怎么解决?
给它一个值!!主键不能为空 ......
在C#中怎么把一个Excel保存成为一个Html文件?
如同在Excel中 文件——保存为——格式选为html 生成的文件 及文件夹(在多张sheet 时)
引用
excelapp.Workbooks[1].PublishObjects ......
我在form1中的某个方法让form2窗体出现
那么这个时候怎么关闭form1而不关闭form2呢?
Form2 f=new Form2();
f.Show();
this.Close();
引用
Form2 f=new Form2();
f.Show();
this.Close();
这样的话整个程 ......
我的ajax的updatepanel控件里的面不能执行response.write,可是我需要弹出对话框,我要怎么做呢?
有没有不需要response.write弹提示框的做法呢?
另外我的页面上有一个web用户控件,然后放一个gridview在updatepa ......
用"服务器控件名.Style.Add("display","")可以给这控件添加CSS,怎么样才能给读出来呢?
怎么都没人帮忙啊
人都死哪去了
控件ID.Style[HtmlTextWriterStyle.BackgroundColor]
控件 ......