protected override void OnSubmit(string actionName, H3.SmartForm.SmartFormPostValue postValue, H3.SmartForm.SubmitSmartFormResponse response) { try { H3.DataModel.BizObject currentObject = this.Request.BizObject;//获取当前表单对象; string pid = currentObject["F0000001"] + string.Empty;//获取关联表单id H3.DataModel.BizObject[] details = (H3.DataModel.BizObject[]) currentObject["D101303Fladqx9gunqpevlb9vucp3kux1"]; //获取子表 if(details != null && details.Length > 0) { foreach(H3.DataModel.BizObject e in details)//循环明细 {
//参数化 List <H3.Data.Database.Parameter> pars = new List<H3.Data.Database.Parameter>(); //添加参数 pars.Add(new H3.Data.Database.Parameter( "@pid", //参数名(与sql中的@name一致) System.Data.DbType.String, //参数值类型 pid//参数值 )); string bm= e["F0000020"] + string.Empty; pars.Add(new H3.Data.Database.Parameter( "@bm", //参数名(与sql中的@name一致) System.Data.DbType.String, //参数值类型 bm //参数值 )); //执行sql string sql = "UPDATE i_D101303Fed91560blxwdoxm1eu107gg22 SET f0000014='审核中' WHERE parentobjectid=@pid AND f0000020=@bm"; this.Engine.Query.QueryTable(sql, pars.ToArray()); } } } catch(Exception ex) { } base.OnSubmit(actionName, postValue, response); }
参考文档地址
氚云帮助中心 https://help.h3yun.com/contents/890/1007.html 《带Parameter sql执行示例:》部分
https://help.h3yun.com/contents/242/278.html 《如何获取/修改子表数据?》部分