Пример #1
0
 public FRMSettingConDB(string pathFile)
 {
     pathFileDB = pathFile;
     InitializeComponent();
     readDB = new ReadFileConDB();
 }
Пример #2
0
        private void Initialize()
        {
            ReadFileConDB readFile = new ReadFileConDB();
            bool resultCheckReadFile = readFile.readFileConDB(pathFileDB);

            if (!resultCheckReadFile)
            {
                MessageBox.Show("ไม่พบไฟล์ที่ใช้เชื่อมต่อฐานข้อมูล");
                FRMSettingConDB settingDB = new FRMSettingConDB(pathFileDB);
                settingDB.ShowDialog();
                return;
            }
            userName = readFile.userName;
            password = readFile.pwd;
            server = readFile.hostName;
            dataBaseName = readFile.dataBaseName;
            port = readFile.port;
            string connectionString = "SERVER=" + server + ";" + "DATABASE=" +
                   dataBaseName + ";" + "UID=" + userName + ";" + "PASSWORD="******";Charset=utf8;";
            connection = new MySqlConnection(connectionString);
            CheckConnect();
            CloseConnection();
            //throw new NotImplementedException();
        }
Пример #3
0
 public FRMSettingConDB(string pathFile)
 {
     pathFileDB = pathFile;
     InitializeComponent();
     readDB = new ReadFileConDB();
 }