读书人

为何执行不了第二条语句?该如何解决

发布时间: 2012-02-15 12:09:44 作者: rapoo

为何执行不了第二条语句?
代码如下;
<%
Sub increate()
sql = "update Mes_account set Account_total = "& (original + tiaoshu) & ",Account_assign = "&(original + tiaoshu)& ",Account_mayuse = "& (original_mayuse + tiaoshu ) & " where Account_id= " & account_id
conn.execute(sql)

sql1= "update Mes_account set Account_assign = "& (target_assign + tiaoshu) & ",Account_space = "&(target_space - tiaoshu) & ",Account_mayuse = "& (target_mayuse - tiaoshu) & " where Account_id = "& Session( "adminid ")
conn.execute(sql1)

Response.Write( " <script language= 'javascript '> alert( '分配成功! ');window.close();window.opener.location.href=window.opener.location.href; </script> ")

End Sub
%>

进行浏览,测试后,执行,发现它并不执行第二条语句sql1,为什么呢?

打印出sql1是正常的.谢谢!

[解决办法]
建议使用数据库的事务,然后看你的第二个T-SQL是否正确,可以先打印出来,然后在数据库客户端工具中去测试。

读书人网 >ASP

热点推荐