<%
'批量生成礼券卡号
if request("action")="save" and request("action") <> empty then
arrName=500
For i = 0 to Ubound(arrName)
password=request.form("password")
set rs=server.createobject("adodb.recordset")
sql="select * from test"
rs.open sql,conn,1,3
rs.addnew
shuzi=cstr(Int((9999 - 1000 + 1) * Rnd() + 1000))
'Conn.execute("insert into product(prname) values('"&Trim(arrName(i))&"')")
rs("username")="&shuzi$i&"
'rs("grade")=request.form("grade")
Next
rs.update
response.write"<Script Language=Javascript>window.alert('成功生成!');location.href='index.asp';</Script>"
response.end
rs.close
set rs=nothing
end if%>
这个是我随便写的。但是不正确
------解决方案-------------------- 二楼能不生成不知道,但知道那个随机号是一样的,因为没有randomize
我的代码生成不了,只是写错一个单词
if Conn.execute("select count(prname) form [product] where prname='"&code&"'")(0)>0 then
改为:
if Conn.execute("select count(prname) from [product] where prname='"&code&"'")(0)>0 then
============已经经过测试,不会重号。