Beispiel #1
0
        public static void ServiceRemove(string toolsFolder, string toolsTempFolder, string servicedesc, string exepath, bool isshow)
        {
            DataTable dtPar = new DataTable();

            dtPar.Columns.Add("name", typeof(string));
            dtPar.Columns.Add("value", typeof(string));
            //然后把你想要加的数据加进DataTable 里
            dtPar.Rows.Add(new object[] { "servicedesc", servicedesc });
            dtPar.Rows.Add(new object[] { "exepath", exepath });
            setConfig setconfig = new setConfig();

            setconfig.repalceParByDefine(toolsFolder, "Service_Unistall.bat", toolsTempFolder, dtPar);
            setBAT.RunBat(toolsTempFolder + @"\Service_Unistall.bat", isshow);
        }
Beispiel #2
0
        public static void SqlExec(string toolsFolder, string toolsTempFolder, string user, string password, string datasource, string sqlfilename, List <string[]> inputList, bool isShow)
        {
            string batfilePath = toolsFolder + "\\sql_exec.bat";
            string sqlfilePath = toolsFolder + "\\sqls\\" + sqlfilename + ".sql";

            DataTable dtPar = new DataTable();

            dtPar.Columns.Add("name", typeof(string));
            dtPar.Columns.Add("value", typeof(string));
            //然后把你想要加的数据加进DataTable 里
            foreach (string[] str in inputList)
            {
                dtPar.Rows.Add(new object[] { str[0], str[1] });
            }
            setConfig setconfig = new setConfig();

            setconfig.repalceParByDefine(toolsFolder + "\\sqls", sqlfilename + ".sql", toolsTempFolder, dtPar);


            string sqlpath = toolsTempFolder + "\\" + sqlfilename + ".sql";
            string logpath = toolsTempFolder + "\\" + sqlfilename + System.Guid.NewGuid().ToString() + ".log";

            List <string[]> BatinputList = new List <string[]>();

            string[] str1 = new string[2];
            str1[0] = "user";
            str1[1] = user;
            BatinputList.Add(str1);
            string[] str2 = new string[2];
            str2[0] = "password";
            str2[1] = password;
            BatinputList.Add(str2);
            string[] str3 = new string[2];
            str3[0] = "datasource";
            str3[1] = datasource;
            BatinputList.Add(str3);
            string[] str4 = new string[2];
            str4[0] = "sqlpath";
            str4[1] = sqlpath;
            BatinputList.Add(str4);
            string[] str5 = new string[2];
            str5[0] = "logpath";
            str5[1] = logpath;
            BatinputList.Add(str5);

            RunBatByDefine(toolsFolder, toolsTempFolder, "sql_exec", BatinputList, isShow);
        }