2/23/2025 4:59:29 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 the use of the SalesLogix Web Platform, Client and Customer Portals, and the Application Architect (For version 7.2 and higher only). View the code of conduct for posting guidelines.
|
|
|
|
Retrieving a value to pass in a QueryString from a SQL Query...
Posted: 20 Jun 08 5:36 AM
|
In the "LoadActions" code snippet of a Form, I need to retrieve a specific value from the DB (From an Unrelated Entity). For this, insted of using IQueryable and IExpressionFactory stuff...can I use the .NET ExecuteNonQuery and normal SELECT Statements?? |
|
|
|
Re: Retrieving a value to pass in a QueryString from a SQL Query...
Posted: 21 Jun 08 1:38 PM
|
First of all, if you are looking to retreive a value, you would be looking to call the ExecuteScalar rather than an ExecuteNonQuery.
Now, for how to do it, using the Reflector's tool, take a peak at the Sage.SalesLogix.Web.WebUserOptionsService.
Look specifically at the getUserPref and the GetOpenConnection functions.
I am sure tha there are probable more examples out there to be found, but this is one that I know of from recent use.
|
|
|
| |
| |
|
Re: Retrieving a value to pass in a QueryString from a SQL Query...
Posted: 24 Jun 08 5:55 PM
|
While the preferred method for reading and updating the database is to use the entity model, you can if needed create an OleDbConnection to read or update values as well (keep in mind doing so does not make use of entity events and rules).
You'll need to get the Data Service for the portal. From there you can get a connection string, or an OleDbConnection object as well.
Get and use a connection string:
Sage.Platform.Data.IDataService service = Sage.Platform.Application.ApplicationContext.Current.Services.Get(); System.Data.OleDbConnection conn = new System.Data.OleDbConnection(service.GetConnectionString()); conn.Open(); //...
or get a connection object:
Sage.Platform.Data.IDataService service = Sage.Platform.Application.ApplicationContext.Current.Services.Get(); using(System.Data.IDbConnection conn = service.GetConnection()) { conn.Open();
System.Data.IDbCommand cmd = conn.CreateCommand(); cmd.CommandText = "select somefield from sometable where somecondition"; object s = cmd.ExecuteScalar().ToString(); //... }
Got it? |
|
|
|
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!
|
|
|
|
|
|
|
|