ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old July 29th, 2003, 09:42 AM
billyducs billyducs is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 4 billyducs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #2  
Old July 29th, 2003, 10:41 AM
karsh44's Avatar
karsh44 karsh44 is offline
Just another guy
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jun 2003
Location: Wisconsin
Posts: 2,915 karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 13 h 6 m 22 sec
Reputation Power: 76
Try this http://support.microsoft.com/?kbid=257731
Also be sure you have newest service packs.
HTH
Dave

Reply With Quote
  #3  
Old July 30th, 2003, 09:43 AM
billyducs billyducs is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 4 billyducs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #4  
Old July 30th, 2003, 09:50 AM
karsh44's Avatar
karsh44 karsh44 is offline
Just another guy
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jun 2003
Location: Wisconsin
Posts: 2,915 karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 13 h 6 m 22 sec
Reputation Power: 76
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.

Reply With Quote
  #5  
Old July 30th, 2003, 10:31 AM
billyducs billyducs is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 4 billyducs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #6  
Old July 30th, 2003, 11:10 AM
billyducs billyducs is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 4 billyducs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy

Nevermind, I used the wrong stored procedure. Duh - It works fine now.

Reply With Quote
  #7  
Old July 30th, 2003, 12:47 PM
karsh44's Avatar
karsh44 karsh44 is offline
Just another guy
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jun 2003
Location: Wisconsin
Posts: 2,915 karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 13 h 6 m 22 sec
Reputation Power: 76
Good

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > batch update


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway