二开案例.Python插件.字符串拼接
【应用场景】在Python插件中,将多段字符串拼接在一起。
【案例演示】SQL拼接
【示例代码】
import clr
clr.AddReference('mscorlib')
clr.AddReference('Kingdee.BOS.App')
from System import *
from Kingdee.BOS.App.Data import *
def BarItemClick(e):
if e.BarItemKey=="tbExecute":
# 修改当前登录用户的描述
userId = this.Context.UserId.ToString();
# 字符串拼接方式1(直接加号拼接)
sql = "UPDATE T_SEC_USER SET FDESCRIPTION=N'哈哈' WHERE FUSERID="+userId;
# 字符串拼接方式2(Python语法)
#sql = "UPDATE T_SEC_USER SET FDESCRIPTION=N'{0}' WHERE FUSERID={1}".format("哈哈",userId);
# 字符串拼接方式3(Python语法)
#sql = str.Format("UPDATE T_SEC_USER SET FDESCRIPTION=N'{0}' WHERE FUSERID={1}","哈哈",userId);
# 字符串拼接方式4(C#语法,需引用mscorlib)
#sql = String.Format("UPDATE T_SEC_USER SET FDESCRIPTION=N'{0}' WHERE FUSERID={1}","哈哈",userId);
# 执行SQL
count = DBUtils.Execute(this.Context,sql);
msg = String.Format("更新成功,SQL:{0},受影响行数:{1}",sql,count);
this.View.ShowMessage(msg);
【金蝶云星空BOS二次开发案例演示】https://vip.kingdee.com/article/94751030918525696
二开案例.Python插件.字符串拼接
本文2024-09-23 04:21:36发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-164803.html