Running a SQL Update Statement from Saleslogix Web

I am working for a client who would like a button to set all of the records in a table to either “Valid” or “” (blank).  This then allows them to build groups on what records needs to be updated.  I started my adventure by reading Kris Halsrud’s post Retrieving the Manager in SalesLogix 7.5 Web .   The solution Kris outlines provided most of what I needed and direct conversation with Kris himself provided the rest.  I wanted to document it here so I do not have to bug him the next time I need to do this.


This is what our C# Snippet Action item looks like launched from the button.


Sage.Platform.Data.IDataService datasvc = Sage.Platform.Application.ApplicationContext.Current.Services.Get<Sage.Platform.Data.IDataService>();

using (System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection(datasvc.GetConnectionString()))

{


conn.Open();

System.Data.OleDb.OleDbCommand cmd =
new System.Data.OleDb.OleDbCommand(update sysdba.TABLE set FIELD = ‘Value’,conn);

cmd.ExecuteNonQuery();


}


 


The green text is the slq statement, the rest should be able to be used as is.  I hope this little post helps someone else down the line.


Thanks


Geo

1 Comment

  1. What about returning a value from a singular field via a select statement …

    Select from where accountid = ‘‘ and product_id = ‘‘ value

    Reply

Submit a Comment

Your email address will not be published.

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!

You have Successfully Subscribed!