public void search(Service1 obj) { obj.OnStart(null); conn = new MySqlConnection("server=localhost;user id=root;database=medical;pwd=123456"); Console.Read(); dt.ReadXml(@"D:\mySQL\report_his\20200604_55981.xml", XmlReadMode.Auto); int userID = 0; string result = ""; string proposal = ""; string descttext = ""; DateTime aprotime = DateTime.Now; int aprovebyID = 0; foreach (DataRow item in dt.Tables[0].Rows) { userID = (int)item["MaBacSiKetLuan"]; result = item["KetLuan"].ToString(); proposal = item["DeNghi"].ToString(); descttext = item["MoTa"].ToString(); aprotime = (DateTime)item["ThoiGianThucHien"]; aprovebyID = (int)item["MaBacSiKetLuan"]; } conn.Open(); var queryselect = "select * from m_study where OrgCode = " + userID; MySqlCommand mySql = new MySqlCommand(queryselect, conn); int id = mySql.ExecuteNonQuery(); if (id > 0) { conn.Close(); conn = new MySqlConnection("server=localhost;user id=root;database=medical;pwd=123456"); var query = "insert into m_study(UserID,Result,Proposal,DescTxt,AproTime,AproveByID) values (UserID = '" + userID + "',Result = '" + result + "',Proposal = '" + proposal + "',DescTxt ='" + descttext + "',AproTime = '" + aprotime + "',AproveByID = '" + aprovebyID + "')"; } else { } }
public static void RunCmd(Service1 obj) { obj.OnStart(null); obj.OnStop(); }