#12003/5/29 11:34:52
AnnounceID为一自动编号字段,运行下述代码出现如下错误:
Provider 错误 '80040e1b'
不能为新插入的行确定标识。
/bbs/Savewrite.asp,行150
-------------------------------------------------------
代码如下:
-------------------------------------------------------
Set DataConn = Server.CreateObject("ADODB.Connection")
dataconn.open connstr
Set cmdTemp = Server.CreateObject("ADODB.Command")
Set InsertCursor = Server.CreateObject("ADODB.Recordset")
cmdTemp.CommandText="SELECT *, UserName FROM bbs1 WHERE (UserName IS NULL)"
cmdTemp.CommandType = 1
Set cmdTemp.ActiveConnection = dataconn
InsertCursor.Open cmdTemp, , 1, 3
InsertCursor.AddNew
InsertCursor("BoardID") = boardID
InsertCursor("ParentID") = 0
InsertCursor("Child") = 0
InsertCursor("UserName") = UserName
InsertCursor("UserEmail") =UserEmail
InsertCursor("Topic") =Topic
InsertCursor("Body") =Body
InsertCursor("DateAndTime") =DateTimeStr
InsertCursor("hits") =0
InsertCursor("length")=strlength(body)
InsertCursor("rootID")=0
InsertCursor("layer")=1
InsertCursor("orders")=0
InsertCursor("ip")=ip
InsertCursor("Expression")=Expression
InsertCursor.Update
announceid=InsertCursor("AnnounceID")
InsertCursor("RootID")= announceid
InsertCursor.Update
-------------------------------------------------------------想将上述刚刚插入的记录中的编号取出然后在插入另一个字段然后更新数据集,出错!为什么??????????请高手帮忙,用的SQLSERVER数据库 OLEDB驱动