7/8/2025 12:34:01 PM
|
|
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!
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.
|
|
|
|
Use DBParamter in External app?
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 |
|
|
|
Re: Use DBParamter in External app?
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? |
|
|
|
Re: Use DBParamter in External app?
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
|
|
|
| |
|
Re: Use DBParamter in External app?
Posted: 21 Aug 07 6:58 PM
|
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
|
|
|
| |
|
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!
|
|
|
|
|
|
|
|