|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
batch update
I've written a script to perform a simple batch update and encountered the following error:
Error Type: Microsoft OLE DB Provider for SQL Server (0x80040E25) Row handles must all be released before new ones can be obtained. Any ideas how to resolve it? My code is as follows: response.write "1st value: " & objRS("FName") & "<br>" objRS("FName") = "Tom" objRS.MoveNext response.write "2nd value: " & objRS("FName") & "<p>" objRS("FName") = "Tim" objRS.UpdateBatch objRS.MoveFirst response.write "Changed 1st value: " & objRS("FName") & "<br>" objRS.MoveNext response.write "Changed 2nd value: " & objRS("FName") Thanks Last edited by billyducs : July 29th, 2003 at 09:48 AM. |
|
#2
|
||||
|
||||
|
Try this http://support.microsoft.com/?kbid=257731
Also be sure you have newest service packs. HTH Dave |
|
#3
|
|||
|
|||
|
Dave,
Thanks for the information. I read the article and adjusted the code: <%@Language=VBScript%> <% option explicit %> <% dim adOpenStatic, adLockBatchOptimistic, adUseClient adOpenStatic = 3 adLockBatchOptimistic = 4 dim objRS set objRS = server.createobject("adodb.recordset") dim strSource strSource = "Provider=SQLOLEDB.1;DRIVER={MS SQL-Server};UID=MyUserID;PWD=MyPassword;DATABASE=Sailors;SERVER=MyServerName" dim sqlStorProc sqlStorProc = "qAllBoatNames" objRS.CursorLocation = adUseClient 'error occurs here objRS.open sqlStorProc, strSource, adOpenStatic, adLockBatchOptimistic response.write "1st value: " & objRS("BoatName") & "<br>" objRS("BoatName") = "A Sweet Song" objRS.MoveNext response.write "2nd value: " & objRS("BoatName") & "<br>" objRS("BoatName") = "Blackbeard" objRS.UpdateBatch objRS.MoveFirst response.write "Changed 1st value: " & objRS("BoatName") & "<br>" objRS.MoveNext response.write "Changed 2nd value: " & objRS("BoatName") & "<br>" objRS.close set objRS = nothing %> --------------------------------- My new error is as follows: Error Type: ADODB.Recordset (0x800A0BB9) Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another. Any other ideas? Thanks, Wills |
|
#4
|
||||
|
||||
|
You haven't defined the variable adUseClient. You need to include adovbs.inc on your page, I think. http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=160 explains the error more.
|
|
#5
|
|||
|
|||
|
I changed the code to the following:
<%@Language=VBScript%> <% option explicit %> <!--#include file="../includes/adovbs.inc"--> <% dim objRS set objRS = server.createobject("adodb.recordset") dim strSource strSource = "Provider=SQLOLEDB.1;DRIVER={MS SQL-Server};UID=MyUserID;PWD=MyPassword;DATABASE=Sailors;SERVER=MyServerName" dim sqlStorProc sqlStorProc = "qAllBoatNames" objRS.CursorLocation = adUseClient objRS.open sqlStorProc, strSource, adOpenStatic, adLockBatchOptimistic response.write "1st value: " & objRS("BoatName") & "<br>" objRS("BoatName") = "A Sweet Song" objRS.MoveNext response.write "2nd value: " & objRS("BoatName") & "<br>" objRS("BoatName") = "Blackbeard" objRS.UpdateBatch objRS.MoveFirst response.write "Changed 1st value: " & objRS("BoatName") & "<br>" objRS.MoveNext response.write "Changed 2nd value: " & objRS("BoatName") & "<br>" objRS.close set objRS = nothing %> Now it does not appear to extract the data from the table. The first two values should be Lyric and Jacko. Instead it displays what I want to change these to and does not update the table. |
|
#6
|
|||
|
|||
|
Nevermind, I used the wrong stored procedure. Duh - It works fine now.
|
|
#7
|
||||
|
||||
|
Good
![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > batch update |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|