Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Tuesday, November 26, 2024 
 
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!
 External Development Forums - SalesLogix OLEDB Provider
Forum to discuss using the SalesLogix OLE DB Provider from external applications (including usage of built-in provider procedures). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix OLEDB Provider | New ThreadView:  Search:  
 Author  Thread: Use DBParamter in External app?
Jeff Ballard
Posts: 326
 
Use DBParamter in External app?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 21 Aug 07 6:10 PM
I've got an external app connecting through the provider. I'm building SQL like this:


StringBuilder SQL = new StringBuilder(@"SELECT * FROM CONTACT WHERE LASTNAME = @LASTNAME";
helper.AddParameter("@LASTNAME", criteria[i].FieldValue);

return helper.ExecuteDataSet(SQL.ToString(), CommanType.Text, ConnectionState.Closed)


But every time I run it, I get a message back from the provider saying "Must declare the variable @LASTNAME". I can reproduce the error using the provider and query express, so I think I may need to find another approach. Fortunately, this is an app that is for a few developers' use only for testing, so if I had to manually build the SQL, I don't need to worry about SQL injection.

FYI, "helper" is an object of type DBHelper - basically a DB utility class and criteria is a generic list of field names and the value to use in the search for that field. I know the code works with MSSQL as the provider, but not with SLX. Anyone have any suggestions or insight?

Thanks,

Jeff
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Use DBParamter in External app?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 21 Aug 07 6:38 PM
MSSQL works with named parameters, the SLX provider does not. Instead of using named parameters, such as "@lastname", simply use "?" for your parameter place holders instead - then just make sure you set the parameter values in order of the ?'s in your query.

Make sense?
[Reply][Quote]
Jeff Ballard
Posts: 326
 
Re: Use DBParamter in External app?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 21 Aug 07 6:39 PM
Makes perfect sense. I'll give it a shot.

Somehow, I'm not surprised you knew the answer!

BTW, my little app has your code about from your article about creating a logon screen in it. I just added an event that gets raised when the logon is complete so anyone can consume the event. The event arguments are the user name, password, initial catalog, data source and whether cancel was pressed so the consumer can do what they see fit with that info. But your code was super handy to get me started.

Thanks for the quick reply!

Jeff

[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Use DBParamter in External app?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 21 Aug 07 6:53 PM
Good to hear. It's great to know when someone gets some real world use from the site.

-Ryan
[Reply][Quote]
Jeff Ballard
Posts: 326
 
Re: Use DBParamter in External app?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 21 Aug 07 6:58 PM
Quote:
Originally posted by Ryan Farley

Good to hear. It's great to know when someone gets some real world use from the site.


I've gotten a *lot* of real world use from stuff here.

And the nameless parameters worked like a charm.

Thanks again!

Jeff
[Reply][Quote]
Carla Tillman
Posts: 290
 
Re: Use DBParamter in External app?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 22 Aug 07 10:42 AM
I second Jeff! This IS the place to get practical help.

Carla
[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 © 2024 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): 11/26/2024 8:18:19 AM