asp利用command访问数据库update问题
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="Connections/myconn2.asp" -->
<%
Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows
Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
Recordset1_cmd.ActiveConnection = MM_myconn2_STRING
Recordset1_cmd.CommandText = "SELECT * FROM liuyan"
Recordset1_cmd.Prepared = true
Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<%
DIM content
content=request("textarea")
Recordset1.addnew
Recordset1("content")=content
Recordset1("username")="admin"
Recordset1.update
Response.Redirect("liuyan.asp")
%>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
我用ADODB.Command方式访问数据库,想用rs.addnew方式增加记录,但报错
”当前记录集不支持更新.这可能是提供程序的限制,也可能是选定锁定类型的限制“
我查了,如果是用rs.open那种方式打开的,则可用参数设定方式消解
但用ADODB.Command,没有open这个步骤,所以不知道怎么改才好
------解决方案--------------------如果用Command那就应该用 SQL的Insert语句,或者直接用存储过程去操作。