我想问一下我下面的这句代码错在哪 运行是老是说错误在'"+TB1.Text +"'也就是说我输入的数字附近有语法错误。
string wqe="select sum (数量) as "+ TB2.Text.Trim()+" from 表 where 代号='"+TB1.Text +"'";
关于这一句我不知道有没有错如果有错哪错也是错在数量='("+wqe+")' 这一句
string sele="update 表 set 数量='("+wqe+")' where 代号='"+TB1.Text +"'";
另外我想问一下从一个数据表中取出数据在减去另一个数据表中的数据改怎么写啊
string sd="select 数量 from 表 where 代号 like '"+TB4.Text +"'";
string sa="select 数量 from 表2 where 序号 like '"+TB3.Text +"'";
然后要让sd-sa这样怎么写啊 小弟不会啊
谢谢了
string wqe="select sum (数量) as "+ TB2.Text.Trim()+" from 表 where 代号='"+TB1.Text +"'";
关于这一句我不知道有没有错如果有错哪错也是错在数量='("+wqe+")' 这一句
string sele="update 表 set 数量='("+wqe+")' where 代号='"+TB1.Text +"'";
另外我想问一下从一个数据表中取出数据在减去另一个数据表中的数据改怎么写啊
string sd="select 数量 from 表 where 代号 like '"+TB4.Text +"'";
string sa="select 数量 from 表2 where 序号 like '"+TB3.Text +"'";
然后要让sd-sa这样怎么写啊 小弟不会啊
谢谢了
用上面的那句就是将数据类型 varchar 转换为 float 时出错。
string sele="update 表 set 数量=("+wqe+") where 代号='"+TB1.Text +"'";
这是都不要单引号时的情况第 1 行: '22' 附近有语法错误。 '22'也就是"+ TB2.Text.Trim()+"
string wqe="select sum (数量)+"+int.Parse(TB7.Text.Trim())+" as result from 表 where 代号='"+TB4.Text +"'";
string sele="update 表 set 备注='"+TB10.Text +"' ,数量=("+wqe+") where 代号 = '"+TB4.Text +"'";