学习自用-执行和查询SQL语句原创
19人赞赏了该文章
799次浏览
编辑于2022年08月12日 16:20:34
执行:
查询(返回JSON格式):
表单插件python 代码
import clr clr.AddReference('System') clr.AddReference('System.Data') clr.AddReference('Kingdee.BOS') clr.AddReference('Kingdee.BOS.Core') clr.AddReference('Kingdee.BOS.App') clr.AddReference('Kingdee.BOS.ServiceHelper') clr.AddReference("Newtonsoft.Json") from Kingdee.BOS import * from Kingdee.BOS.Core import * from Kingdee.BOS.Core.Bill import * from Kingdee.BOS.Core.DynamicForm.PlugIn import * from Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel import * from System import * from System.Data import * from Kingdee.BOS.App.Data import * from System.Collections.Generic import List from Kingdee.BOS.ServiceHelper import * from Newtonsoft.Json.Linq import * from Newtonsoft.Json import JsonConvert def ButtonClick(e): ksql = ""; msg=""; kbutton=e.Key.ToUpperInvariant(); if(kbutton=="F_WHKF_BUTTON"): ksql = this.Model.GetValue("FSEL").ToString(); ds = DBServiceHelper.ExecuteDataSet(this.Context, ksql); if (ds.Tables.Count ==1): msg = JsonConvert.SerializeObject(ds.Tables[0]); this.Model.SetValue("FRESULT", msg); if(kbutton=="F_WHKF_BUTTON1"): ksql = this.Model.GetValue("FBODY").ToString(); msg = str(DBServiceHelper.Execute(this.Context,ksql)); this.View.ShowMessage("执行成功,受影响"+msg+"条记录");
学习自用,仅用于备份留档。
赞 19
19人点赞
还没有人点赞,快来当第一个点赞的人吧!
打赏
0人打赏
还没有人打赏,快来当第一个打赏的人吧!
推荐阅读