- 爱易网页
-
MSSQL教程
- 留言本有关问题
日期:2014-05-18 浏览次数:20491 次
留言本问题
<html xmlns= "http://www.w3.org/1999/xhtml ">
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 " />
<title> 留言本 </title>
<style type= "text/css ">
<!--
.style1{font-size:12px}
.style2{font-size:12px;font-weight:bold;}
-->
</style>
</head>
<body>
<%
set conn=server.createobject( "adodb.connection ")
conn.connectionstring= "driver={sql server};server=.;database=lyb.mdb;uid=sa;pwd=12345; "
%>
<%
title=request.form( "title ")
if title <> " " then
set rs=server.createobject( "adodb.recordset ")
rs.open "lyb ",conn,3,3
rs.addnew
rs( "title ")=title
rs( "content ")=request.form( "content ")
rs( "datetime ")=now()
rs.update
end if
%>
<form name= "form1 " method= "post " action= " ">
<p align= "center " class= "style2 "> 留言本-添加留言内容 </p>
<table width= "479 " border= "0 " align= "center " cellpadding= "5 " cellspacing= "1 " bgcolor= "#cccccc ">
<tr bgcolor= "#ffffff ">
<td width= "86 "> <div align= "center "> <span class= "sytle1 "> 标题: </span> </div> </td>
<td width= "304 " height= "30 "> <input name= "title " type= "text " id= "title "> </td>
</tr>
<tr bgcolor= "#ffffff ">
<td> <div align= "center "> <span class= "sytle1 "> 内容: </span> </div> </td>
<td> <textarea name= "content " cols= "50 " rows= "20 " id= "content "> </textarea> </td>
</tr>
<tr bgcolor= "#ffffff ">
<td colspan= "2 "> <div align= "center ">
<input type= "submit " name= "submit " value= "提交 ">
<input type= "button " name= "submit " value= "查看留言 " onclick= "location " href= 'showcontent.asp '>
<input type= "reset " name= "submit " value= "重置 ">
</div>
</td>
</tr>
</table>
</form>
</body>
</html>
这段代码执行了以后,出来的是一个表单,但当我把数据提交到数据的时候出现了这样的问题.
错误类型:
ADODB.Recordset (0x800A0E7D)
连接无法用于执行此操作。在此上下文中它可能已被关闭或无效。
/TEST/addcontent.asp, 第 24 行