怎么在asp中的一个页面里调用两次或更多次sql语句,给一个格式吧,

来源:百度知道 编辑:UC知道 时间:2024/06/01 04:27:51
还有要实现表单传过来的值与数据库中的值相加后再存入数据库,格式怎么写啊,这样写对吗? rs("amount")=rs("amount")+request("biaodan") biaodan是从表单传过来的值, amount是数据库中的字段属性
这样写对不对啊:
sql1="select top 10 * where id="&ID
rs.open sql1,conn,1,1
rs("amount")=rs("amount")+request("biaodan")
sql2="select top 10 * where amount='"&aa&"'"
rs.open sql2,conn,1,3

差不多了,你参考一下我的吧:

这样写,你要先打开数据库,读取了rs.
好像也只能这样了,因为你要得到数据库里的值,一定是要先打开,再读取的.
不过好像你这样是不能更新到数据库里的.
你要再写一次数据库.
dim aa
'----------------这下面的.
aa=rs("amount")+request("biaodan")
sql2="update 你的表 set rs("amount")='"&aa&"' where id="&id
conn.execute sql2
这样试下吧.