コード例 #1
0
ファイル: MainForm.cs プロジェクト: nhatduyak/FrontEndTool
        public void LayCauHinh()
        {
            byte[]       key      = Blowfish.GetBytes(this.str123).Clone() as byte[];
            Blowfish     blowfish = new Blowfish(key);
            StringReader reader   = new StringReader(blowfish.ReadFromFile(Application.StartupPath + @"\Config.tps"));

            this._dsKetNoi = new DataSet();
            this._dsKetNoi.ReadXml(reader);
            if (this._dsKetNoi.Tables[0].Rows.Count < 1)
            {
                throw new Exception("File cấu hình không có kết nối nào");
            }
            ReadXML xml = new ReadXML();

            xml.db_name     = Convert.ToString(_dsKetNoi.Tables["KetNoi"].Rows[0]["DBName"]);
            xml.db_server   = Convert.ToString(_dsKetNoi.Tables["KetNoi"].Rows[0]["ServerName"]);
            xml.db_username = Convert.ToString(_dsKetNoi.Tables["KetNoi"].Rows[0]["UserName"]);
            xml.db_password = Convert.ToString(_dsKetNoi.Tables["KetNoi"].Rows[0]["Password"]);
            ConnectDb.Connect(xml.db_server, xml.db_name, xml.db_username, xml.db_password);
            txtDBname.Caption += xml.db_server + " - " + xml.db_name;
            try
            {
                reader.Close();
            }
            catch
            {
            }
        }