<!--#include file="../include/Conn_Folder.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<link href="../css/default.css" rel="stylesheet" type="text/css">
</head>
<body>
<%
Id=request("Id")
caseId=request("caseId")
newsort=request("newsort")
function object_selected(current_value,value)
if current_value=value then
sel_str="selected"
else
sel_str=""
end if
object_selected=sel_str
end function
%>
<form action="caselist_add_save.asp" method="post" name="form">
<table width="100%%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="30" width="98"> <b>1.</b>选择画家: </td>
<td height="30" colspan="4"> <select name="newsort" style="WIDTH: 120px; COLOR: navy; font-size:9pt">
<%
set myrs_child=server.CreateObject("adodb.recordset")
myrs_child.Open "select id,name from [case] order by id",conn,1,1
if myrs_child.RecordCount=0 then
myrs_child.Close
set myrs_child=nothing
else
do until myrs_child.EOF
Response.Write "<option value='" & myrs_child("id") & "' " & object_selected(caseId,cstr(myrs_child("id"))) & ">" & myrs_child("name") & "</option>"
myrs_child.MoveNext
loop
myrs_child.Close
set myrs_child=nothing
end if
%>
</select> </td>
</tr>
<tr>
<td> <b>2.</b>所属栏目:</td>
<td> <select name="sortid" style="WIDTH: 120px; COLOR: navy; font-size:9pt">
<%
set myrs_child1=server.CreateObject("adodb.recordset")
myrs_child1.Open "select id,sortname from [case_sort] order by id",conn,1,1
if myrs_child1.RecordCount=0 then
myrs_child1.Close
set myrs_child1=nothing
else
do until myrs_child1.EOF
Response.Write "<option value='" & myrs_child1("id") & "'" & object_selected(newsort,cstr(myrs_child1("id"))) & ">" & myrs_child1("sortname") & "</option>"
myrs_child1.MoveNext
loop
myrs_child1.Close
set myrs_child1=nothing
end if
%>
</select></td>
</tr>
<tr>
<td> <b>2.</b>添加标题:</td>
<td> <input name="title"
class=box1
style="WIDTH: 200px; COLOR: navy; HEIGHT: 20px;" size=78
></td>
</tr>
<tr>
<td> <b>3.</b>作者内容</td>
<td><INPUT type="hidden" name="content1" value="请输入内容">
<IFRAME ID="eWebEditor1" src="../WebEditor/ewebeditor.asp?id=content1&style=s_coolblue" frameborder="0" scrolling="no" width="550" height="350"></IFRAME></td>
</tr>
<tr>
<td> </td>
<td>
<input type="hidden" name="edit_action" value="add_new">
<input type="submit" name="Submit" value=" 提 交 ">
<input type="reset" name="Submit2" value=" 重 置 "></td>
</tr>
</table>
</form>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<link href="../css/default.css" rel="stylesheet" type="text/css">
</head>
<body>
<%
Id=request("Id")
caseId=request("caseId")
newsort=request("newsort")
function object_selected(current_value,value)
if current_value=value then
sel_str="selected"
else
sel_str=""
end if
object_selected=sel_str
end function
%>
<form action="caselist_add_save.asp" method="post" name="form">
<table width="100%%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="30" width="98"> <b>1.</b>选择画家: </td>
<td height="30" colspan="4"> <select name="newsort" style="WIDTH: 120px; COLOR: navy; font-size:9pt">
<%
set myrs_child=server.CreateObject("adodb.recordset")
myrs_child.Open "select id,name from [case] order by id",conn,1,1
if myrs_child.RecordCount=0 then
myrs_child.Close
set myrs_child=nothing
else
do until myrs_child.EOF
Response.Write "<option value='" & myrs_child("id") & "' " & object_selected(caseId,cstr(myrs_child("id"))) & ">" & myrs_child("name") & "</option>"
myrs_child.MoveNext
loop
myrs_child.Close
set myrs_child=nothing
end if
%>
</select> </td>
</tr>
<tr>
<td> <b>2.</b>所属栏目:</td>
<td> <select name="sortid" style="WIDTH: 120px; COLOR: navy; font-size:9pt">
<%
set myrs_child1=server.CreateObject("adodb.recordset")
myrs_child1.Open "select id,sortname from [case_sort] order by id",conn,1,1
if myrs_child1.RecordCount=0 then
myrs_child1.Close
set myrs_child1=nothing
else
do until myrs_child1.EOF
Response.Write "<option value='" & myrs_child1("id") & "'" & object_selected(newsort,cstr(myrs_child1("id"))) & ">" & myrs_child1("sortname") & "</option>"
myrs_child1.MoveNext
loop
myrs_child1.Close
set myrs_child1=nothing
end if
%>
</select></td>
</tr>
<tr>
<td> <b>2.</b>添加标题:</td>
<td> <input name="title"
class=box1
style="WIDTH: 200px; COLOR: navy; HEIGHT: 20px;" size=78
></td>
</tr>
<tr>
<td> <b>3.</b>作者内容</td>
<td><INPUT type="hidden" name="content1" value="请输入内容">
<IFRAME ID="eWebEditor1" src="../WebEditor/ewebeditor.asp?id=content1&style=s_coolblue" frameborder="0" scrolling="no" width="550" height="350"></IFRAME></td>
</tr>
<tr>
<td> </td>
<td>
<input type="hidden" name="edit_action" value="add_new">
<input type="submit" name="Submit" value=" 提 交 ">
<input type="reset" name="Submit2" value=" 重 置 "></td>
</tr>
</table>
</form>
</body>
</html>
ASP表单与数据库交互页面示例
此博客展示了一个ASP页面代码,包含与数据库的交互。页面通过表单让用户选择画家、所属栏目,添加标题和内容。使用函数处理选项选中状态,通过SQL查询从数据库获取数据并展示在下拉框中,最后可提交表单数据。
29

被折叠的 条评论
为什么被折叠?



