Author |
Topic  |
|
TastyNutz
Junior Member
 
USA
251 Posts |
Posted - 27 October 2007 : 21:22:50
|
I have an Access db which I want to be able to view/update via an admin form. I've tried and tried again, but I keep getting the error:
"Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype."
My code:
I've "googled" my eyes crossed, but can't find a solution. Anyone know the answer? |
PowerQuad Disability Support Forum |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
|
pdrg
Support Moderator
    
United Kingdom
2897 Posts |
Posted - 30 October 2007 : 13:12:38
|
It'll be the wrong cursor type (maybe a firehose cursor by default which is fast but forward only read only, as opposed to something like an updateable cursor (which uses way more system resources)). Hunt the web/db documentation for 'ADO cursor types' and you may find some. My bet is that the variable conn (which contains your connectionstring) either misses out the cursor type or has the wrong one.
Better still, do as Rui suggests and step up a level and use an INSERT with the COMMAND object in ADO instead |
 |
|
TastyNutz
Junior Member
 
USA
251 Posts |
Posted - 14 November 2007 : 16:07:46
|
I'm still confused by cursor types, but during my search and from a working example, I arrived at a solution:
rs.open strSQL, cn, 2, 3
It works, but I'm not sure why. Are the parameters in red setting the cursor type?
Please be gentle with me. I'm trying to learn. |
PowerQuad Disability Support Forum |
 |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
|
TastyNutz
Junior Member
 
USA
251 Posts |
Posted - 14 November 2007 : 19:05:57
|
Thanks rui. The updates are for admin settings and product updates, so I guess performance speed isn't critical. The original code is part of a crappy product catalog that I'm building into an ecommerce template. By time I add validation and fix all of other issues, there won't be much of the original code left! |
PowerQuad Disability Support Forum |
 |
|
pdrg
Support Moderator
    
United Kingdom
2897 Posts |
Posted - 15 November 2007 : 11:39:55
|
http://msdn2.microsoft.com/en-us/library/ms681510.aspx http://msdn2.microsoft.com/en-us/library/ms681771.aspx http://msdn2.microsoft.com/en-us/library/ms681771.aspx
The 2 red variables are exactly right - the first is CursorType, the second CursorLocation. Personally I'd consider 2, 2 (the default) but if 2, 3 is working for you, all well and good.
Cursor Type 2 = adOpenDynamic Uses a dynamic cursor. Additions, changes, and deletions by other users are visible, and all types of movement through the Recordset are allowed, except for bookmarks, if the provider doesn't support them.
ADO is a fascinating technology, it can be handy to read up about it and get to understand how it works :-) I'd still advise using an UPDATE though in terms of server stress it's a lot lighter. |
 |
|
TastyNutz
Junior Member
 
USA
251 Posts |
Posted - 15 November 2007 : 14:06:53
|
Thanks for the resources. Looks like I have a little "light reading" to do.
I'm wondering if I could convince you or someone to look thru my template once it's more complete? I could really use the expertise of a real programmer to check for vulnerabilities, inefficiencies, etc. That is, if I can afford you, and you promise not to laugh at my cobbled up code!  |
PowerQuad Disability Support Forum |
 |
|
pdrg
Support Moderator
    
United Kingdom
2897 Posts |
Posted - 16 November 2007 : 07:55:47
|
I honestly doubt if my reading your code will help much -
1) Reading someone else's code is near-impossible, ASP doubly so. 2) I'm very rusty 3) Vulns and inefficiencies I may be able to spot a couple
Sorry |
 |
|
AnonJr
Moderator
    
United States
5768 Posts |
Posted - 16 November 2007 : 08:33:05
|
I'd go ahead and post it - the worst that happens is no one takes a look, which leaves you in the same place you were if you didn't post it. The best that happens is a bunch of people suddenly get the spare time to take a look at it and help you with some of the weak spots.
Its worth noting that unless you've commented your code well, its hard enough to read your own code let alone someone else's.... that's probably why they call it "code"! 
And by "commenting well" I'm referring to quality, not quantity - there is a difference.
Its also worth noting that you may find it easier to work with the ADO constants instead of the numbers they represent. Snitz has the inc_adovbs.asp file that defines all those constants and includes them in config.asp since its easier to remember "adOpenDynamic" than "2 is the cursor type that I want".  |
 |
|
AnonJr
Moderator
    
United States
5768 Posts |
Posted - 16 November 2007 : 08:37:15
|
Oh, and don't worry about being embarrassed by your code - we all had to start somewhere, and I honestly believe that everyone has some program that they wrote when they were first starting out that holds some "embarrassing moments" - now having that and being man/woman enough to admit it are two different things.
I will admit that the LMS that I'm upgrading I wrote while I was transitioning from VB6 to ASP/VBScript and learning about web programming as I went. I'm finding a lot of code I wouldn't exactly brag about...  |
 |
|
TastyNutz
Junior Member
 
USA
251 Posts |
|
|
Topic  |
|