7/6/2025 1:29:58 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.
|
|
|
|
Running a custom query in Saleslogix Web 7.5
Posted: 08 May 09 8:54 AM
|
Can anyone please help me to run custom SQLs and manipulate record sets in a C# Code snippet? In fact I need to iterate through a set of records and update another table.
Thanks in advance |
|
|
|
Re: Running a custom query in Saleslogix Web 7.5
Posted: 09 May 09 8:56 PM
|
Mathew,
I haven't worked with Web a lot but my understanding is that you can use ADO.Net (System.Data, System.Data.OleDb, etc.). to do your SQL tasks. Below is an example of retrieving a scalar value. Notice in that the SLX Connection String (SLX OleDB Provider) is being retrieved via the service.GetConnectionString() method, with is a SLX-specific method. Being that this is an OleDB provider, methods from the System.Data.OleDB namespace are being used which is from the standard .Net class libraries. If you look at Microsoft's .Net SDK documentation, you can see there are useful classes such as OleDBCommand, OleDBDataReader, etc.
//Get connection string string connStr = service.GetConnectionString(); using (System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection(connStr)) { //Open connection conn.Open(); using (System.Data.OleDb.OleDbCommand cmd = new System.Data.OleDb.OleDbCommand()) { //Build and execute SQL sql = "SELECT USERID FROM USERPROFILE WHERE USERID = '" + curUserID + "'"; cmd.Connection = conn; cmd.CommandText = sql; try { //If the statements executes then there is a value yourVal = cmd.ExecuteScalar().ToString();
} catch { //SQL returned a null.
}
Hope this helps.
C. Burriss
|
|
|
| |
|
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!
|
|
|
|
|
|
|
|