ExecSql()

Executes the SQL statement.

Use this method to execute statements that do not return rows. For example, DELETE, INSERT, or UPDATE.

To execute statements that do return rows (SELECT statements), use SelectSql().

Parameters

None

Examples

var sql;
sql = "UPDATE Company SET Comp_PrimaryUserID='"+AccountMgr+"' WHERE "+" Comp_CompanyId="+Values('Comp_CompanyId');
CRM.ExecSql(sql);

Executes the SQL UPDATE statement.

var myQuery;
var myResult;
myQuery = CRM.CreateQueryObj("update company set comp_source = 'TEST' where comp_source is null","");
myResult = myQuery.ExecSql();
CRM.AddContent("Number of updated records: "+myResult);
Response.Write(CRM.GetPage());

Updates company records and shows the number of updated records.