xinzheng 发布留言 2008-7-8 19:55
请问这样写对吗?怎么样好?
<%
strsql="select id,pro_name,spbh from pro_list where pro_type=35 order by spbh"
set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strsql, conn, 1, 1
%>
<% do while not rs.Eof%>
"title="<%=rs("pro_name")%>" class="spbh"><%=rs("spbh")%>
<%rs.movenext
loop
%>
<%
rs.close%>
<%
strsql="select id,pro_name,spbh from pro_list where pro_type=33 order by spbh"
set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strsql, conn, 1, 1
%>
<% do while not rs.Eof%>
"title="<%=rs("pro_name")%>" class="spbh"><%=rs("spbh")%>
<%rs.movenext
loop
%>
<%
rs.close%>
<%
strsql="select id,pro_name,spbh from pro_list where pro_type=34 order by spbh"
set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strsql, conn, 1, 1
%>
<% do while not rs.Eof%>
"title="<%=rs("pro_name")%>" class="spbh"><%=rs("spbh")%>
<%rs.movenext
loop
%>
<%
rs.close%>
<%
strsql="select id,pro_name,spbh from pro_list where pro_type=36 order by spbh"
set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strsql, conn, 1, 1
%>
<% do while not rs.Eof%>
"title="<%=rs("pro_name")%>" class="spbh"><%=rs("spbh")%>
<%rs.movenext
loop
%>
<%
rs.close%>
我只贴了代码部分,我是想一个页面丽显示几个不同的商品类~
multiple1902 发布留言 2008-7-8 21:37
做成过程,实现代码复用好。
xinzheng 发布留言 2008-7-8 23:40
[un]multiple1902[/un] 在 2008-7-8 21:37 的发言:[/bo]
做成过程,实现代码复用好。 |
能举个例子吗?过程我不懂啊,谢谢了
yms123 发布留言 2008-7-9 00:16
个人觉得一个rs频繁开关并不比多个rs对象省内存。
页: [1]