asp 代码,谁能把这两个文件合成一个啊
tj.asp:<formmethod="POST"action="tj1.asp"><p>姓名:<inputtype="text"name="name"size="20"...
tj.asp:
<form method="POST" action="tj1.asp">
<p>姓名:<input type="text" name="name" size="20"></p>
<p>电话:<input type="text" name="tel" size="20"></p>
<p>备注:<textarea rows="4" name="content" cols="20"></textarea></p>
<p>
<input type="submit" value="提交" name="B1">
<input type="reset" value="重置" name="B2"></p>
</form>
下面是tj1.asp的代码:
<%
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("db1.mdb")
exec="select * from aaa"
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,3,3
name=request.form("name")
tel=request.form("tel")
content=request.form("content")
rs.addnew
rs("name")=name
rs("tel")=tel
rs("content")=content
rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing
response.write "<script language=JavaScript>" & chr(13) & "alert('记录添加成功!');" & "window.location.href = 'index.asp'" & "</script>"
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
一楼的不行呀,运行出错
总是 500
我把我能发现的问题都改了,还是不行 展开
<form method="POST" action="tj1.asp">
<p>姓名:<input type="text" name="name" size="20"></p>
<p>电话:<input type="text" name="tel" size="20"></p>
<p>备注:<textarea rows="4" name="content" cols="20"></textarea></p>
<p>
<input type="submit" value="提交" name="B1">
<input type="reset" value="重置" name="B2"></p>
</form>
下面是tj1.asp的代码:
<%
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("db1.mdb")
exec="select * from aaa"
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,3,3
name=request.form("name")
tel=request.form("tel")
content=request.form("content")
rs.addnew
rs("name")=name
rs("tel")=tel
rs("content")=content
rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing
response.write "<script language=JavaScript>" & chr(13) & "alert('记录添加成功!');" & "window.location.href = 'index.asp'" & "</script>"
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
一楼的不行呀,运行出错
总是 500
我把我能发现的问题都改了,还是不行 展开
2个回答
展开全部
<form method="POST" name="form">
<p>姓名:<input type="text" name="name" size="20"></p>
<p>电话:<input type="text" name="tel" size="20"></p>
<p>备注:<textarea rows="4" name="content" cols="20"></textarea></p>
<p>
<input type="submit" value="提交" name="B1">
<input type="hidden" name="hid" value="ok">
<input type="reset" value="重置" name="B2"></p>
</form>
<%
if request("hid")="ok" then
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("db1.mdb")
exec="select * from aaa"
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,3,3
name=request.form("name")
tel=request.form("tel")
content=request.form("content")
rs.addnew
rs("name")=name
rs("tel")=tel
rs("content")=content
rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing
response.write "<script language=JavaScript>" & chr(13) & "alert('记录添加成功!');" & "window.location.href = 'index.asp'" & "</script>"
rs.close
set rs=nothing
conn.close
set conn=nothing
end if
%>
<p>姓名:<input type="text" name="name" size="20"></p>
<p>电话:<input type="text" name="tel" size="20"></p>
<p>备注:<textarea rows="4" name="content" cols="20"></textarea></p>
<p>
<input type="submit" value="提交" name="B1">
<input type="hidden" name="hid" value="ok">
<input type="reset" value="重置" name="B2"></p>
</form>
<%
if request("hid")="ok" then
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("db1.mdb")
exec="select * from aaa"
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,3,3
name=request.form("name")
tel=request.form("tel")
content=request.form("content")
rs.addnew
rs("name")=name
rs("tel")=tel
rs("content")=content
rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing
response.write "<script language=JavaScript>" & chr(13) & "alert('记录添加成功!');" & "window.location.href = 'index.asp'" & "</script>"
rs.close
set rs=nothing
conn.close
set conn=nothing
end if
%>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<%
if request.Form("B1")<>"" then
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("db1.mdb")
exec="select * from aaa"
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,3,3
name=request.form("name")
tel=request.form("tel")
content=request.form("content")
rs.addnew
rs("name")=name
rs("tel")=tel
rs("content")=content
rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing
response.write "<script language=JavaScript>" & chr(13) & "alert('记录添加成功!');" & "window.location.href = 'index.asp'" & "</script>"
end if
%>
<form method="POST" action="tj.asp">
<p>姓名:<input type="text" name="name" size="20"></p>
<p>电话:<input type="text" name="tel" size="20"></p>
<p>备注:<textarea rows="4" name="content" cols="20"></textarea></p>
<p>
<input type="submit" value="提交" name="B1">
<input type="reset" value="重置" name="B2"></p>
</form>
if request.Form("B1")<>"" then
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("db1.mdb")
exec="select * from aaa"
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,3,3
name=request.form("name")
tel=request.form("tel")
content=request.form("content")
rs.addnew
rs("name")=name
rs("tel")=tel
rs("content")=content
rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing
response.write "<script language=JavaScript>" & chr(13) & "alert('记录添加成功!');" & "window.location.href = 'index.asp'" & "</script>"
end if
%>
<form method="POST" action="tj.asp">
<p>姓名:<input type="text" name="name" size="20"></p>
<p>电话:<input type="text" name="tel" size="20"></p>
<p>备注:<textarea rows="4" name="content" cols="20"></textarea></p>
<p>
<input type="submit" value="提交" name="B1">
<input type="reset" value="重置" name="B2"></p>
</form>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询