select * from eptime_zhanghu where id=6怎样把6换成变量
select * from eptime_zhanghu where id=6怎样把6换成变量。
也就是在Eptime_zhanghu表中选择部门后,预算金额在Eptime_zhanghu表中就自动填入预算金额表单中,且无法修改。以上代码运行正常,就是sql="select * from eptime_zhanghu where id=6"这句,不知道怎么才能实现选择部门后,查询到该部门id的记录。代码如下:
<td align="right" height="30">部门名称:</td>
<td class="category">
<%
sql="select * from Eptime_zhanghu order by id"
set rs_zhanghu=conn.execute(sql)
if rs_zhanghu.eof then
%>
<script language="javascript">
alert("请先添加部门!")
window.location.href="zhanghu_add.asp"
</script>
<%
response.end
else
%>
<select name="zhanghu" style="width:200px">
<%
do while rs_zhanghu.eof=false
%>
<option value="<%=rs_zhanghu("id")%>"<%if rs_zhanghu("id")=CInt(request.Cookies("zhanghu")) then%> selected="selected"<%end if%>><
%=rs_zhanghu("name")%></option>
<%
rs_zhanghu.movenext
loop
%>
</select>
<%
end if
%><font color="#ff0000">*</font></td>
</tr>
<input type="hidden" name="id" value="<%=nowid%>">
<%
sql="select * from eptime_zhanghu where id=6"
set rs_yusuan=conn.execute(sql)
if rs_yusuan.eof then%>
<script language="javascript">
alert("没有查询到相关数据!")
window.location.href="zhanghu_add.asp"
</script><%
end if
%>
<tr>
<td align="right" height="30">预算金额:</td>
<td class="category"><input type="text" name="price" value="<%=rs_yusuan("yusuan")%>" disabled="true" style="width:200px"
onKeyUp="value=value.replace(/[^\d.]/g,'')">
<font color="#666666">元</font>
<font color="#ff0000">*</font>(其中部门人数为<%=rs_yusuan("amount")%>人,预算标准为<%=rs_yusuan("type")%>元。)
</td>