用吸管折星星怎么折:asp中有关update里有变量的用法

来源:百度文库 编辑:高考问答 时间:2024/05/10 09:36:25
我在用asp时,有一个要update的,语句如下:
conn.execute("select count(*) as newphotonum from imgdata")
conn.execute("update config set PhotoNum=photonum-"&newphotonum&""
但是有错,怎么改啊?
怎么用变量接收select count(*)的返回值?

conn.execute("select count(*) as newphotonum from imgdata")
这条只是执行了一下,你并没有给任何变量赋值,所以conn.execute("update config set PhotoNum=photonum-"&newphotonum&"" 中的 newphotonum值是空的,这样就错了。

你需要定义一个变量来接收conn.execute("select count(*) as newphotonum from imgdata")这条语句返回的结果,然后再执行下面的语句。

conn.execute("update config set PhotoNum=photonum-"&newphotonum&"")

set rs=conn.execute("select count(*) as newphotonum from imgdata")

rs(0) 就是你需要的变量