|
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv = "Content-Type" content = "text / html; charset = gb2312" />
<title> Guestbook </ 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"> Guestbook-Add message content </ 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"> Title: </ 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"> Content: </ 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 = "submit">
<input type = "button" name = "submit" value = "view message" onclick = "location" href = 'showcontent.asp'>
<input type = "reset" name = "submit" value = "Reset">
</ div>
</ td>
</ tr>
</ table>
</ form>
</ body>
</ html>
After this code was executed, a form came out, but this problem occurred when I submitted the data to the data.
Error type:
ADODB.Recordset (0x800A0E7D)
Connection cannot be used to perform this operation. It may be closed or invalid in this context.
/TEST/addcontent.asp, line 24
Please help to see, it's been an afternoon, it's really anxious. |
|