import tkinter as tk
import pymssql
import tkinter.messagebox
from tkinter import *
import configparser
config = configparser.ConfigParser()
config.read('setup.ini', encoding='utf-8')
server_a = config['connpz']['server1']
user_a = config['connpz']['user1']
password_a = config['connpz']['password1']
database_a = config['connpz']['database1']
#sql_a = config['sqlpz']['sql']
conn = pymssql.connect(server_a,user_a,password_a,database_a, charset="cp936", autocommit=True)
root = tk.Tk()
root.title("诊断修改工具")
root.geometry('750x550')
label1 = tk.Label(root,text="错误ICD:",width=10,height=2)
label1.grid(row=0,column=0)
c_input = tk.Entry(root,font=("宋体", 22))
c_input.grid(row=0, column=1)
c_input_z=c_input.get()
label2 = tk.Label(root,text="正确ICD:",width=10,height=2)
label2.grid(row=1,column=0)
z_input = tk.Entry(root,font=("宋体", 22))
z_input.grid(row=1, column=1)
z_input_z = z_input.get()
text = tk.Text(root, width=105, height=30, undo=True, autoseparators=False) #文本框
text.grid(row=3, column=0,columnspan=4)
c=conn.cursor()
def xiugai1():
sql1 = """update h_zyxx set cyzd='%s' where cyzd='%s' and rq>='2023-01-01 00:00:00' """ % (z_input_z, c_input_z)
c.execute(sql1)
() ################这个提交没有效果,哪位大神帮看看原因,新手学习请多指教##############
text.insert(1.0,"-修改诊断1-")
#关闭游标
#c.close()
#c.close()
#关闭链接
x_button=tk.Button(root,text="修改",width=10,command=xiugai1)
x_button.grid(row=2,column=0,columnspan=2,sticky="w", padx=20, pady=20)
button=tk.Button(root,text="关闭",width=10,command=root.quit)
button.grid(row=2,column=1,columnspan=1,sticky="e", padx=20, pady=20)
root.mainloop()