asp中的sql語句變量引用問題(50分)

  • 主题发起人 williamguo188
  • 开始时间
W

williamguo188

Unregistered / Unconfirmed
GUEST, unregistred user!
<%@LANGUAGE=&quot;VBSCRIPT&quot;
CODEPAGE=&quot;950&quot;%>
<!--#include file=&quot;conn.asp&quot;
-->
<html>
<head>
<meta http-equiv=&quot;Content-Type&quot;
content=&quot;text/html;
charset=big5&quot;>
<title>sqltable</title>
</head>
<body>
<form name=&quot;form1&quot;
method=&quot;post&quot;
action=&quot;&quot;>
<table width=&quot;700&quot;
border=&quot;1&quot;
align=&quot;center&quot;>
<tr>
<td width=&quot;170&quot;>bigtypename</td>
<td width=&quot;175&quot;><select name=&quot;select1&quot;
style=&quot;width:160px &quot;>
<option value=&quot;-&quot;>請選擇大類別</option>
<%
strsql=&quot;select * from bigtype&quot;
set rs=conn.execute(strsql)
do
until rs.eof
big_id=trim(rs.fields(0).value)
big_id_name=trim(rs.fields(1).value)
%>
<option value=<%=big_id%>><%=big_id_name%></option>
<%
rs.movenext
loop
rs.close
rs=null
%>
</select></td>
<td width=&quot;170&quot;>billtypename</td>
<td width=&quot;160&quot;><select name=&quot;select2&quot;
style=&quot;width:160px &quot;>
<option value=&quot;-&quot;>請選擇小類別</option>

<%
strsql1=&quot;select * from smalltype where nametype=big_id_name> &quot;
set rs=conn.execute(strsql1)
do
until rs.eof
billid=trim(rs.fields(1).value)
%>
<option value=&quot;-&quot;><%=billid%></option>
<%
rs.movenext
loop
rs.close
rs=null
%>

</select></td>
</tr>
</table>
<table width=&quot;700&quot;
border=&quot;1&quot;
align=&quot;center&quot;>
<tr>
<td width=&quot;100&quot;>id</td>
<td width=&quot;150&quot;>name</td>
<td width=&quot;150&quot;>nametype</td>
<td width=&quot;150&quot;>prise</td>
<td width=&quot;150&quot;>number</td>
</tr>
</table>
<p> </p>
</form>
</body>
</html>
這里面有兩個表,有一個相同的字段.
我想在第二個sql語句引big_id_name變量!
請高手指點,多謝?
 
strsql1=&quot;select * from smalltype where nametype='&quot;
& Trim(big_id_name) &&quot;'&quot;
 
接受答案了.
 
顶部