做一个ASP的级联,下拉菜单点击不同的地区,就显示不同的自动编号,但是为什么<option value="<%=cgid%>">汕头</option> 时候,就可以自动编号+1.。。。而 <option value="51<%=cgid%>">汕头</option>在前面加数字的时候,他就不会+1了,麻烦高手帮我看看。。。谢谢
<%
set rs=server.CreateObject("adodb.recordset")
'锁定指定记录通过with(updlock)完成。
sql="select id from baogao with(updlock) "
rs.open sql,conn,1,3
'将日期转换为YYYYMMDD格式的字符串
if len(month(date()))=1 then
cmonth="0"& cstr(month(date()))
else
cmonth=cstr(month(date()))
end if
if len(day(date()))=1 then
cday="0"& cstr(day(date()))
else
cday=cstr(day(date()))
end if
if not rs.eof then
set rs_M=server.CreateObject("adodb.recordset")
sql="select max(bh) as id from baogao"
rs_M.open sql,conn,1,3
str=rs_M("id")
no=cstr(int(mid(str,11,5))+1)
select case len(no)
case 1
cno="0000"+no
case 2
cno="000"+no
case 3
cno="00"+no
case 4
cno="0"+no
case 5
cno=no
case else
cno="00001"
end select
intno="ST"&cstr(year(date()))&cmonth&cday&cno '组成新的数据编号
cgid=intno
end if
%>
项目编号:
<label for="bh2"></label>
<input name="bh" type="text" id="bh2" value="" readonly="readonly"></th>
<th width="234" height="39" scope="col"><strong><div align="left"><div align="left">关联汇总:<label for="select"></label>
<select name="select" id="select" onChange="document.getElementsByName('bh')[0].value=this.value">
<option value=<%=rs("typename")%>><%=rs("typename")%></option>
<option value="51<%=cgid%>">汕头</option>
<option value="52<%=cgid%>">广州</option>
</select>
<strong> </strong></th>
<%
set rs=server.CreateObject("adodb.recordset")
'锁定指定记录通过with(updlock)完成。
sql="select id from baogao with(updlock) "
rs.open sql,conn,1,3
'将日期转换为YYYYMMDD格式的字符串
if len(month(date()))=1 then
cmonth="0"& cstr(month(date()))
else
cmonth=cstr(month(date()))
end if
if len(day(date()))=1 then
cday="0"& cstr(day(date()))
else
cday=cstr(day(date()))
end if
if not rs.eof then
set rs_M=server.CreateObject("adodb.recordset")
sql="select max(bh) as id from baogao"
rs_M.open sql,conn,1,3
str=rs_M("id")
no=cstr(int(mid(str,11,5))+1)
select case len(no)
case 1
cno="0000"+no
case 2
cno="000"+no
case 3
cno="00"+no
case 4
cno="0"+no
case 5
cno=no
case else
cno="00001"
end select
intno="ST"&cstr(year(date()))&cmonth&cday&cno '组成新的数据编号
cgid=intno
end if
%>
项目编号:
<label for="bh2"></label>
<input name="bh" type="text" id="bh2" value="" readonly="readonly"></th>
<th width="234" height="39" scope="col"><strong><div align="left"><div align="left">关联汇总:<label for="select"></label>
<select name="select" id="select" onChange="document.getElementsByName('bh')[0].value=this.value">
<option value=<%=rs("typename")%>><%=rs("typename")%></option>
<option value="51<%=cgid%>">汕头</option>
<option value="52<%=cgid%>">广州</option>
</select>
<strong> </strong></th>



这个人叫白衣