| 发表于:2007-03-05 09:21:49 楼主 |
c#代码如下 string str = "server=www-20bcfcb54f2;database=df;uid=sa;pwd=a "; sqlconnection con = new sqlconnection(str); sqlcommand jisuancommand = new sqlcommand( "jisuan ", con); jisuancommand.commandtype = commandtype.storedprocedure; sqlparameter parameter = jisuancommand.parameters.add( "@a ", sqldbtype.char, 5); parameter.value = "1 "; parameter = jisuancommand.parameters.add( "@b ", sqldbtype.char, 5); parameter.value = "5 "; con.open(); 存储过程如下 create procedure jisuan @a char(5),@b char(5) as insert into table1 (daihege,daidong,id1) select daihege,daidong,id1 from jingzi where pihao> =@a and pihao <=@b update jingzi set jingzi.zchanliang=isnull(jingzi.shuliang,0)+(isnull(jingzi.daidong,0)-isnull((select isnull(daidong,0) from table1 where id1=tep.id1-1),0))/2,jingzi.zhege=isnull(jingzi.hege,0)+(isnull(jingzi.daihege,0)-isnull((select isnull(daihege,0) from table1 where id1=tep.id1-1),0))/2 from table1 as tep where jingzi.id1=tep.id1 go 为什么表中的数据无变化啊 |
|
|
|
|