Exemple #1
0
        private void btn_Comm_Click(object sender, EventArgs e)
        {
            Changes sChk  = new Changes();
            string  sPath = Application.StartupPath;
            int     index = 0;

            try
            {
                StreamReader sRead = new StreamReader(sPath + "\\Logs.ini");
                string       sShow;
                while ((sShow = sRead.ReadLine()) != null)
                {
                    switch (index)
                    {
                    case 0: comm.GET_DBComm = sChk.Get_Crack(true, sShow); break;

                    case 1: comm.SET_DBComm = sChk.Get_Crack(true, sShow); break;
                    }
                    index++;
                }
                lMessage.Text = "連線成功";
                if (!comm.commDB(comm.GET_DBComm) || !comm.commDB(comm.SET_DBComm))
                {
                    lMessage.Text = "ERROR-001 : 連線失敗";
                }
                sRead.Close();
            }
            catch (Exception) { lMessage.Text = "ERROR-002 : Logs.ini遺失,無法連線"; }
        }