Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Thursday, August 28, 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: Application.GetNewConnection.Execute
20pippo05
Posts: 46
 
Application.GetNewConnection.ExecuteYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 03 Mar 09 9:54 AM
I have a problem with this instructions.
INTERNALPRODUCTNO is a field of PRODUCTOROGRAMTABLE

1) n= Application.GetNewConnection.Execute( "SELECT COUNT (*) FROM PRODUCTPROGRAM WHERE INTERNALPRODUCTPROGRAMNO='" &code& "' ")
2) if(n>1) then.....

but send error on instruction 2.
What store in n?
[Reply][Quote]
Stainless Steel Snake
Posts: 32
 
Re: Application.GetNewConnection.ExecuteYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 04 Mar 09 1:37 AM
ADODB recordset.
[Reply][Quote]
20pippo05
Posts: 46
 
Re: Application.GetNewConnection.ExecuteYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 04 Mar 09 1:44 AM
ok,but how i can write the condition on n?
[Reply][Quote]
Stainless Steel Snake
Posts: 32
 
Re: Application.GetNewConnection.ExecuteYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 04 Mar 09 5:27 AM
Set objRS = Application.GetNewConnection.Execute( "SELECT COUNT (*) AS N FROM PRODUCTPROGRAM WHERE INTERNALPRODUCTPROGRAMNO='" &code& "' ")
if ( CInt(objRS.Fields("N").Value) > 1 ) then ...


P.S. Google+MSDN will help you
[Reply][Quote]
Walter Shpuntoff
Posts: 167
 
Re: Application.GetNewConnection.ExecuteYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 04 Mar 09 5:33 AM
recordsets are not a single value - that is what it is complaining about

set n= Application.GetNewConnection.Execute( "SELECT COUNT (*) FROM PRODUCTPROGRAM WHERE INTERNALPRODUCTPROGRAMNO='" &code& "' ")

if(n.fields(0).value >1) then.....

I doesn't clean up after itself though... so memory leakage may occur if you use this a lot
better to do something like this:

If FetchSingleValueFromDatabase("SELECT COUNT (*) FROM PRODUCTPROGRAM WHERE INTERNALPRODUCTPROGRAMNO='" &code& "' ") > 1 then

where you have defined a function

Function FetchSingleValueFromDatabase(Query)
dim cn, r
set cn = application.getnewconnection
set r = cn.execute(query)
FetchSingleValueFromDatabase = r.fields(0).value
set r = nothing
set cn = nothing
exit function

ws
[Reply][Quote]
20pippo05
Posts: 46
 
Re: Application.GetNewConnection.ExecuteYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 04 Mar 09 8:12 AM
thank you....
[Reply][Quote]
Phil Parkin
Posts: 819
Top 10 forum poster: 819 posts
 
Re: Application.GetNewConnection.ExecuteYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 04 Mar 09 7:21 PM
Or use the OOTB GetField(Field, Table, Where) function ....
[Reply][Quote]
RJ Samp
Posts: 973
Top 10 forum poster: 973 posts
 
Re: Application.GetNewConnection.ExecuteYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 13 Mar 09 10:57 AM
Does this still hiccup on Count(*), SUM(*), et al.....works fine for simple fields......
[Reply][Quote]
RJ Samp
Posts: 973
Top 10 forum poster: 973 posts
 
Re: Application.GetNewConnection.ExecuteYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 13 Mar 09 10:58 AM
IF r returns nothing or a null your function will hiccup.....
[Reply][Quote]
Stainless Steel Snake
Posts: 32
 
Re: Application.GetNewConnection.ExecuteYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 16 Mar 09 2:26 AM
Just need to correct SQL query, and then the problems will not happen.
[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/28/2025 5:14:02 PM