473,413 Members | 2,066 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

Current Recordset does not support updating

7
Hi Anyone help?

Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype.
/anata/Send_OrderList.asp, line 102

My Code as below
Expand|Select|Wrap|Line Numbers
  1. <% 
  2.  
  3. CC_OrderAction=Request.ServerVariables("SCRIPT_NAME")
  4. if Request("CC_OrderInsert") <> "" then
  5. TimeKey=GetTimeInMillisec()
  6. rsTimekey.AddNew                                 (This is line102)
  7. rsTimekey("Timekey")=TimeKey
  8. For Each fld in rsTimekey.Fields
  9. if Len(Request(fld.Name)) > 0 then
  10. fld.Value = Request(fld.Name)
  11. end if
  12. Next
  13. rsTimekey.Update
  14. rsTimekey.Requery
  15. rsTimekey.Filter= "Timekey='" & TimeKey & "'"
  16. Session("OrderID")=Session("OrderID")
  17. end if
Feb 26 '10 #1
9 6511
GazMathias
228 Expert 128KB
You need to use a locktype that supports updating in the ADO recordset.open method, the default is read only.

Example
Expand|Select|Wrap|Line Numbers
  1. rs.open SQL,conn,1,2
  2.  
Hope that helps.

Gaz
Feb 26 '10 #2
AAKK
7
Hi Thank for your reply
sorry I m new for this asp
May i know where to put this code?

I try to rewrite the code to below
'
CC_OrderAction=Request.ServerVariables("SCRIPT_NAM E")
if Request("CC_OrderInsert") <> "" then
TimeKey=GetTimeInMillisec()
rsTimekey.open SQL,conn,1,2
rsTimekey.AddNew

rsTimekey("Timekey")=TimeKey
For Each fld in rsTimekey.Fields
if Len(Request(fld.Name)) > 0 then
fld.Value = Request(fld.Name)
end if
Next
rsTimekey.Update
rsTimekey.Requery
rsTimekey.Filter= "Timekey='" & TimeKey & "'"
Session("OrderID")=rsTimekey("OrderID")
end if
%>

but it turn up again message

Error Type:
ADODB.Recordset (0x800A0E79)
Operation is not allowed when the object is open.
/anata/Send_OrderList.asp, line 105
Feb 27 '10 #3
GazMathias
228 Expert 128KB
Hi

Somewhere in your code you should have a line that starts like this:
Expand|Select|Wrap|Line Numbers
  1. rsTimekey.Open '... more code
  2.  
Try adding this before it:
Expand|Select|Wrap|Line Numbers
  1. rsTimekey.LockType = adLockPessimistic
  2.  
Hope that helps

Gaz.
Feb 27 '10 #4
AAKK
7
HI
after studying the locktype
i still could not figure out the place to insert
therefore,better to provide you all code
easy for you check
hoping you will help
Expand|Select|Wrap|Line Numbers
  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="950"%>
  2. <!--#include file="inc_CharonCart.asp" -->
  3. <script language="javascript" runat="server">
  4.  
  5. function GetTimeInMillisec()
  6. {
  7.     var Now = new Date()
  8.     var TimeStamp = Now.getTime()
  9.  
  10.     return TimeStamp
  11. }
  12.  
  13. </script>
  14. <!--#include file="Connections/Data.asp" -->
  15. <!--#include virtual="/anata/Connections/data.asp" -->
  16. <%
  17. Dim rs1stCatalogs
  18. Dim rs1stCatalogs_cmd
  19. Dim rs1stCatalogs_numRows
  20.  
  21. Set rs1stCatalogs_cmd = Server.CreateObject ("ADODB.Command")
  22. rs1stCatalogs_cmd.ActiveConnection = MM_Data_STRING
  23. rs1stCatalogs_cmd.CommandText = "SELECT * FROM tCatalogs ORDER BY CatalogID ASC" 
  24. rs1stCatalogs_cmd.Prepared = true
  25.  
  26. Set rs1stCatalogs = rs1stCatalogs_cmd.Execute
  27. rs1stCatalogs_numRows = 0
  28. %>
  29. <%
  30. Dim rsShowCatalog
  31. Dim rsShowCatalog_cmd
  32. Dim rsShowCatalog_numRows
  33.  
  34. Set rsShowCatalog_cmd = Server.CreateObject ("ADODB.Command")
  35. rsShowCatalog_cmd.ActiveConnection = MM_Data_STRING
  36. rsShowCatalog_cmd.CommandText = "SELECT * FROM tCatalogs" 
  37. rsShowCatalog_cmd.Prepared = true
  38.  
  39. Set rsShowCatalog = rsShowCatalog_cmd.Execute
  40. rsShowCatalog_numRows = 0
  41. %>
  42. <%
  43. Dim rsPayData__MMColParam
  44. rsPayData__MMColParam = "1"
  45. If (Session("OrderID") <> "") Then 
  46.   rsPayData__MMColParam = Session("OrderID")
  47. End If
  48. %>
  49. <%
  50. Dim rsPayData
  51. Dim rsPayData_cmd
  52. Dim rsPayData_numRows
  53.  
  54. Set rsPayData_cmd = Server.CreateObject ("ADODB.Command")
  55. rsPayData_cmd.ActiveConnection = MM_data_STRING
  56. rsPayData_cmd.CommandText = "SELECT PayWay, GrandPrice FROM tOrderData WHERE OrderID = ?" 
  57. rsPayData_cmd.Prepared = true
  58. rsPayData_cmd.Parameters.Append rsPayData_cmd.CreateParameter("param1", 5, 1, -1, rsPayData__MMColParam) ' adDouble
  59.  
  60. Set rsPayData = rsPayData_cmd.Execute
  61. rsPayData_numRows = 0
  62. %>
  63.  
  64. <%
  65. Dim rsOrderList
  66. Dim rsOrderList_cmd
  67. Dim rsOrderList_numRows
  68.  
  69. Set rsOrderList_cmd = Server.CreateObject ("ADODB.Command")
  70. rsOrderList_cmd.ActiveConnection = MM_data_STRING
  71. rsOrderList_cmd.CommandText = "SELECT * FROM tOrderList" 
  72. rsOrderList_cmd.Prepared = true
  73.  
  74. Set rsOrderList = rsOrderList_cmd.Execute
  75. rsOrderList_numRows = 0
  76. %>
  77. <%
  78.  
  79. Dim rsTimekey
  80. Dim rsTimekey_cmd
  81. Dim rsTimekey_numRows
  82.  
  83. Set rsTimekey_cmd = Server.CreateObject ("ADODB.Command")
  84. rsTimekey_cmd.ActiveConnection = MM_data_STRING
  85. rsTimekey_cmd.CommandText = "SELECT * FROM tOrderTimekey" 
  86.  
  87. Set rsTimekey = rsTimekey_cmd.Execute
  88. rsTimekey_numRows = 0
  89. %>
  90. <%
  91. Dim Repeat1__numRows
  92. Dim Repeat1__index
  93.  
  94. Repeat1__numRows = -1
  95. Repeat1__index = 0
  96. rs1stCatalogs_numRows = rs1stCatalogs_numRows + Repeat1__numRows
  97. %>
  98. <% 
  99. '
  100. 'Insert record into Orders recordset when form is submitted
  101. 'and store the unique OrderID
  102. '
  103. CC_OrderAction=Request.ServerVariables("SCRIPT_NAME")
  104. if Request("CC_OrderInsert") <> "" then
  105. TimeKey=GetTimeInMillisec()
  106.  
  107. rsTimekey("Timekey")=TimeKey
  108. For Each fld in rsTimekey.Fields
  109. if Len(Request(fld.Name)) > 0 then
  110. fld.Value = Request(fld.Name)
  111. end if
  112. Next
  113. rsTimekey.Update
  114. rsTimekey.Requery
  115. rsTimekey.Filter= "Timekey='" & TimeKey & "'"
  116. Session("OrderID")=rsTimekey("OrderID")
  117. end if
  118. %>
  119. <% 
  120.  
  121. CC_OrderAction=Request.ServerVariables("SCRIPT_NAME")
  122. if Request("CC_OrderInsert") <> "" then
  123. TimeKey=GetTimeInMillisec()
  124. rsTimekey.AddNew
  125. rsTimekey("Timekey")=TimeKey
  126. For Each fld in rsTimekey.Fields
  127. if Len(Request(fld.Name)) > 0 then
  128. fld.Value = Request(fld.Name)
  129. end if
  130. Next
  131. rsTimekey.Update
  132. rsTimekey.Requery
  133. rsTimekey.Filter= "Timekey='" & TimeKey & "'"
  134. Session("OrderID")=Session("OrderID")
  135. end if
  136. %>
Mar 1 '10 #5
jhardman
3,406 Expert 2GB
the more common way to open a recordset is this:
Expand|Select|Wrap|Line Numbers
  1. dim rs, conn
  2. set conn=server.createObject("adodb.connection")
  3. conn.open connectionString
  4.  
  5. set rs = server.createObject("adodb.recordset")
  6. rs.open command, conn, locktype, cursortype 
Your method doesn't use this syntax, you declare the recordset by making a adodb.command, and then calling execute and dumping the result into the recordset variable. I don't think that method will work if you want to update your recordset. I suggest you rework the code to use the method I highlighted above, locktype and cursortype are both constants, 2 and 3 will work for you. Let me know if this helps.

Jared

BTW, I'm going to add code tags to make your post more readable. In the future please enclose your code in [ code]...[/code] tags
Mar 1 '10 #6
AAKK
7
HI Thank
it work
thank for your helping
Mar 3 '10 #7
AAKK
7
Microsoft OLE DB Provider for ODBC Drivers (0x80040E2F)
[Microsoft][ODBC Microsoft Access Driver] The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship. Change the data in the field or fields that contain duplicate data, remove the index, or redefine the index to permit duplicate entries and try again.
/anata/Send_OrderList.asp, line 205

Expand|Select|Wrap|Line Numbers
  1. ODRecordset.AddNew
  2. ODRecordset.Fields(UniqueIdColumn)=UniqueIdValue
  3. ODRecordset.Fields("Quantity")=CCcart(CC_Quantity,i)
  4. ODRecordset.Fields("Name")=CCcart(CC_Name,i)
  5. ODRecordset.Fields("SalePrice")=CCcart(CC_Price,i)
  6. rsOrderList.Update'(line 205)
Mar 3 '10 #8
jhardman
3,406 Expert 2GB
I assume the UniqueIdColumn is an auto-incrementing key field. Don't set the auto-increment number! The recordset object will do that automatically when you call "update".

Jared

Please type the following after your code block:
[/code]
And type this right before your code block:
[code]
failure to do so could make me lose my temper
Mar 3 '10 #9
AAKK
7
Hi My data is Access
so Now,I took away the prime key
it look like work
THK
Mar 6 '10 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Zlatko Matić | last post by:
There is a form (single form) and a combobox. I want that current record of the form is adjusted according to selected value in the combobox. Cuurrent record should be the same as the value in the...
36
by: kjvt | last post by:
Based on a prior posting, I've written a function to convert a recordset to a dataview. The first call to the function for a given recordset works perfectly, but the second call always returns a...
2
by: barret bonden | last post by:
(closest newsgroup I could find) Error Type: ADODB.Recordset (0x800A0CB3) Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype....
5
by: Hexman | last post by:
I've come up with an error which the solution eludes me. I get the error: >An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in HRTest.exe > >Additional...
9
by: Johnfli | last post by:
ADODB.Recordset error '800a0cb3' Current Recordset does not support bookmarks. This may be a limitation of the provider or of the selected cursortype. I am moving my webserver from NT4 using SQL...
3
by: melnhed | last post by:
---Report the current filtered records from a Form--- Hello All, I've seen this topic discussed before, but the solution described then doesn't work in my particular case. My Config: ...
8
by: jamesnkk | last post by:
I got this Run-time error 3251 Current Recrdset does not support updating. This may be limation of the provider, or of the selected locktype. Dim red1 As New ADODB.Recordset Dim strmess As...
7
by: michal | last post by:
hi guys, i am using postgres 8.2 and try to add some records to a table with ADODO ... unfortunately i end up with an error when calling the addNew() method. it says that the recordset does not...
9
by: BlackMustard | last post by:
Hi, I get the following error on the last line: Run-time error '3251': Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype. ...
0
ADezii
by: ADezii | last post by:
When you create an ADO Recordset, you should have some idea as to what functionality the Recordset does/does not provide. Some critical questions may, and should, be: Can I add New Records to the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.