ASP如何实现从access的一个表格中调取一列的值作为下拉框的值,然后写入到另一个表格中?
现在一个access中有2个表格,一个表格名[dianpu],在里面有一个字段“dianpu”,现在要实现把这个“dianpu”里的值作为一个下拉框中的选项,然后写入到另...
现在一个access中有2个表格,一个表格名[dianpu],在里面有一个字段“dianpu” ,现在要实现把这个“dianpu”里的值作为一个下拉框中的选项,然后写入到另一个表[list]表的“dianpu”字段里。?
<%
select case action
case"0"
If Request.form("add")=" 添 加 " Then
Set rs = Server.CreateObject("ADODB.RecordSet")
Sql = "Select * From [list] Where danhao='"&Request.form("danhao")&"'"
rs.Open Sql,Conn,1,1
If Not (rs.Eof or rs.Bof) Then
Response.Write "<script>alert('维修单号已存在!');this.location.href='?add=0';</SCRIPT>"
Response.End
rs.clsoe
end if
Set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open Sql,Conn,1,3
rs.addNew
rs("addTime") = Request.form("adddate")
rs("data") = Request.form("adddate")
rs("kehu") = checkform(Request.form("kehu"))
rs("kehu2") = checkform(Request.form("kehu2"))
rs("danhao") = checkform(Request.form("danhao"))
rs("dianhua") = checkform(Request.form("dianhua"))
rs("leixing") = checkform(Request.form("leixing"))
rs("xinghao") = checkform(Request.form("xinghao"))
rs("err1") = checkform(Request.form("err1"))
rs("beizhu") = checkform(Request.form("beizhu"))
rs("jindu") = "已经提交维修单"
rs("Moneys") = "0"
rs("Moneys2") = "0"
rs("user")=""
rs.Update
rs.Close
Response.Write "<script>alert('操作成功!');this.location.href='right.asp';</SCRIPT>"
End if
%> 展开
<%
select case action
case"0"
If Request.form("add")=" 添 加 " Then
Set rs = Server.CreateObject("ADODB.RecordSet")
Sql = "Select * From [list] Where danhao='"&Request.form("danhao")&"'"
rs.Open Sql,Conn,1,1
If Not (rs.Eof or rs.Bof) Then
Response.Write "<script>alert('维修单号已存在!');this.location.href='?add=0';</SCRIPT>"
Response.End
rs.clsoe
end if
Set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open Sql,Conn,1,3
rs.addNew
rs("addTime") = Request.form("adddate")
rs("data") = Request.form("adddate")
rs("kehu") = checkform(Request.form("kehu"))
rs("kehu2") = checkform(Request.form("kehu2"))
rs("danhao") = checkform(Request.form("danhao"))
rs("dianhua") = checkform(Request.form("dianhua"))
rs("leixing") = checkform(Request.form("leixing"))
rs("xinghao") = checkform(Request.form("xinghao"))
rs("err1") = checkform(Request.form("err1"))
rs("beizhu") = checkform(Request.form("beizhu"))
rs("jindu") = "已经提交维修单"
rs("Moneys") = "0"
rs("Moneys2") = "0"
rs("user")=""
rs.Update
rs.Close
Response.Write "<script>alert('操作成功!');this.location.href='right.asp';</SCRIPT>"
End if
%> 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励10(财富值+成长值)+提问者悬赏5(财富值+成长值)
2个回答
展开全部
所在地区:
<%
dim sql1,rs1
set rs1=Server.CreateObject("ADODB.RecordSet")
sql1="select * from [dianpu]"
rs1.open sql1,conn,1,3
%>
<select name="icity" id="icity">
<option value=""> </option>
<%
do while not rs1.eof
Response.Write "<option value="&rs1("dianpu")&">"&rs1("dianpu")&"</option> " & vbCrLf
rs1.movenext
loop
%>
</select>
<%
dim sql1,rs1
set rs1=Server.CreateObject("ADODB.RecordSet")
sql1="select * from [dianpu]"
rs1.open sql1,conn,1,3
%>
<select name="icity" id="icity">
<option value=""> </option>
<%
do while not rs1.eof
Response.Write "<option value="&rs1("dianpu")&">"&rs1("dianpu")&"</option> " & vbCrLf
rs1.movenext
loop
%>
</select>
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询