public FRMSettingConDB(string pathFile) { pathFileDB = pathFile; InitializeComponent(); readDB = new ReadFileConDB(); }
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(); }