Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Sunday, August 24, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Architect Forums - SalesLogix Scripting & Customization
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: Weird ADO error...
Jeff Ballard
Posts: 326
 
Weird ADO error...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 25 Jun 08 11:47 AM
Referring to the code below, when I run it and take out the stop statement (or just say no to the debugger prompt), the message box shows the count to be 3 and the error message alerted is an empty string

When I put in the stop statement (or just say yes to the debugger) and step through, the parameter count is 6 and I receive the error message "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done."

Anyone know why this is? I assume it has to do with timing, but it's just weird.

Jeff
On Error Resume Next
sql = "UPDATE Table1 SET field1 = ?, field2 = ? WHERE prkey = ?"
Dim oSlxDB
Set oSlxDb = New SLX_DB
Dim cmd
Set cmd = CreateObject("ADODB.Command")
cmd.ActiveConnection = oSlxDb.Connection
Stop
With cmd
.CommandType = adCmdText
.Prepared = True
.CommandText = sql
.Parameters.Append .CreateParameter("field1", adNumeric, adParamInput, , value1)
.Parameters.Append .CreateParameter("field2", adDBDate, adParamInput, , value2)
.Parameters.Append .CreateParameter("field3", adVarChar, adParamInput, 12, value3)
MsgBox "count: " & cmd.Parameters.Count
.Execute
End With
MsgBox "description: " & Err.Description
[Reply][Quote]
Timmus Agersea
Posts: 328
 
Re: Weird ADO error...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 25 Jun 08 12:47 PM
Jeff,

If you access the parameters collection via the debugger, it auto loads the parameters for you. Thus, when you append 3 more params you have 6. You can just get rid of your appends and set the values as such:
.Parameters(0).Value = value1
etc

HTH!

Timmus
[Reply][Quote]
Jeff Ballard
Posts: 326
 
Re: Weird ADO error...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 25 Jun 08 3:23 PM
I actually had done that, but couldn't figure out why every example I've seen had the appends statement. Being a little obsessive about these things, I couldn't let it go. What I didn't realize is that the debugger auto-loads the parameters for you. That seems a bit odd; I would expect the debugger to show you what it has, but not add them for you. That certainly explains the issue, though.

Thanks, and it did help!

Jeff
[Reply][Quote]
Timmus Agersea
Posts: 328
 
Re: Weird ADO error...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 25 Jun 08 3:26 PM
Happy to help, Jeff. I do want to clarify that I did not mean the debugger autoloads the params. Accessing the parameters collection triggers ADO to load the params if the collection is empty. If you would have accessed the collection in your code before your breakpoint you would have seen the 3 params would have already been there.

BTW I typically add params explicitly in my code as well.

Timmus
[Reply][Quote]
Jeff Ballard
Posts: 326
 
Re: Weird ADO error...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 25 Jun 08 3:35 PM
Got - that makes more sense than the debugger auto-populating them.

Call me crazy, but I don't like the idea that accessing it auto-populates them. I personally think it should throw an exception if I attempt to access a non-existent collection. Oh, well, at least I know what's causing what I was seeing.

Thx again!

Jeff
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 8/24/2025 1:04:37 PM