private void btnTestConnection_Click(object sender, EventArgs e) { strServer = txtServerName.Text.Trim(); strDatabase = txtDatabaseName.Text.Trim(); strUser = txtUserName.Text.Trim(); strPassword = txtPassword.Text.Trim(); if (strServer == "" || strDatabase == "" || strUser == "") { MessageBox.Show(this, "Test Connection string failed!", "Paradise", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { try { EzSqlCollection.EzSql2 ezsql2 = new EzSqlCollection.EzSql2(strServer, strDatabase, strUser, strPassword); ezsql2.open(); ezsql2.close(); MessageBox.Show(this, "Test Connection string successfully!", "Paradise", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch { MessageBox.Show(this, "Test Connection string failed!", "Paradise", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public BaseForm() { InitializeComponent(); if (HPA.Common.StaticVars.ServerName == null) return; DBEngine = new EzSqlCollection.EzSql2(HPA.Common.StaticVars.ServerName, HPA.Common.StaticVars.DatabaseName, HPA.Common.StaticVars.UserID_sql, HPA.Common.StaticVars.Password); DBEngine.open(); }
public BaseForm() { InitializeComponent(); if (HPA.Common.StaticVars.ServerName == null) { return; } DBEngine = new EzSqlCollection.EzSql2(HPA.Common.StaticVars.ServerName, HPA.Common.StaticVars.DatabaseName, HPA.Common.StaticVars.UserID_sql, HPA.Common.StaticVars.Password); DBEngine.open(); }
public BaseUserControl() { InitializeComponent(); if (this.DesignMode) { return; } if (HPA.Common.StaticVars.ServerName == null) { return; } try { DBEngine = new EzSqlCollection.EzSql2(HPA.Common.StaticVars.ServerName, HPA.Common.StaticVars.DatabaseName, HPA.Common.StaticVars.UserID_sql, HPA.Common.StaticVars.Password); DBEngine.open(); } catch { //throw new Exception("Can not connect to server"); if (MessageBox.Show("Ket noi lai ko?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Yes) { DBEngine = new EzSqlCollection.EzSql2(HPA.Common.StaticVars.ServerName, HPA.Common.StaticVars.DatabaseName, HPA.Common.StaticVars.UserID_sql, HPA.Common.StaticVars.Password); DBEngine.open(); MessageBox.Show("ket noi thanh cong"); } } if (StaticVars.FullClassName.Equals(string.Empty)) { return; } object objRight = DBEngine.execReturnValue("SC_USEROBJECTRIGHT_GET", "@p_FullClassName", StaticVars.FullClassName, "@p_LoginID", StaticVars.LoginID); if ((objRight == DBNull.Value) || (Convert.ToInt32(objRight) == 0)) { Methods.ShowMessage(CommonConst.NO_RIGHT_TO_ACCESS); return; } else { _UserRight = objRight; } }
private void btnSave_Click(object sender, EventArgs e) { StaticVars.ConnectionString = String.Format("Server = {0}{1}Database = {2}{1}UID = {3}{1}PWD = {4}", txtServerName.Text.Trim(), SEMICOLON_CHAR, txtDatabaseName.Text.Trim(), txtUserName.Text.Trim(), txtPassword.Text.Trim()); try { EzSqlCollection.EzSql2 ezsql2 = new EzSqlCollection.EzSql2(txtServerName.Text.Trim(), txtDatabaseName.Text.Trim(), txtUserName.Text.Trim(), txtPassword.Text.Trim()); ezsql2.open(); ezsql2.close(); Methods.WriteFile(Encryption.EncryptText(StaticVars.ConnectionString, true)); MessageBox.Show(this, "Connection setting has saved successfully. Changes will be applied for the next log on.", "Paradise", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch { MessageBox.Show(this, "Connection setting can not saved. Please re-install Paradise if you can.", "Paradise", MessageBoxButtons.OK, MessageBoxIcon.Error); } isNewConnection = false; }
private void btnSave_Click(object sender, EventArgs e) { StaticVars.ConnectionString = String.Format("Server = {0}{1}Database = {2}{1}UID = {3}{1}PWD = {4}", txtServerName.Text.Trim(), SEMICOLON_CHAR, txtDatabaseName.Text.Trim(), txtUserName.Text.Trim(), txtPassword.Text.Trim()); try { EzSqlCollection.EzSql2 ezsql2 = new EzSqlCollection.EzSql2(txtServerName.Text.Trim(), txtDatabaseName.Text.Trim(), txtUserName.Text.Trim(), txtPassword.Text.Trim()); ezsql2.open(); ezsql2.close(); Methods.WriteFile(Encryption.EncryptText(StaticVars.ConnectionString, true)); MessageBox.Show(this, "Connection setting has saved successfully. Changes will be applied for the next log on.", "Paradise", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch { MessageBox.Show(this, "Connection setting can not saved. Please re-install Paradise if you can.", "Paradise", MessageBoxButtons.OK, MessageBoxIcon.Error); } isNewConnection = false; }
private void btnClose_Click(object sender, EventArgs e) { if (!isNewConnection) { try { EzSqlCollection.EzSql2 ezsql2 = new EzSqlCollection.EzSql2(txtServerName.Text.Trim(), txtDatabaseName.Text.Trim(), txtUserName.Text.Trim(), txtPassword.Text.Trim()); ezsql2.open(); ezsql2.close(); Application.Restart(); } catch { MessageBox.Show(this, "Connection setting is not available.", "Paradise", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else Application.Exit(); }
private void btnClose_Click(object sender, EventArgs e) { if (!isNewConnection) { try { EzSqlCollection.EzSql2 ezsql2 = new EzSqlCollection.EzSql2(txtServerName.Text.Trim(), txtDatabaseName.Text.Trim(), txtUserName.Text.Trim(), txtPassword.Text.Trim()); ezsql2.open(); ezsql2.close(); Application.Restart(); } catch { MessageBox.Show(this, "Connection setting is not available.", "Paradise", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { Application.Exit(); } }
public SaveData(string scrName, EzSqlCollection.EzSql2 DBE) { DBEngine = DBE; screenName = scrName; }
public SaveData(string scrName, EzSqlCollection.EzSql2 DBE) { DBEngine = DBE; screenName = scrName; }
private void btnTestConnection_Click(object sender, EventArgs e) { strServer = txtServerName.Text.Trim(); strDatabase = txtDatabaseName.Text.Trim(); strUser = txtUserName.Text.Trim(); strPassword = txtPassword.Text.Trim(); if (strServer == "" || strDatabase == "" || strUser == "") { MessageBox.Show(this, "Test Connection string failed!", "Paradise", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { try { EzSqlCollection.EzSql2 ezsql2 = new EzSqlCollection.EzSql2(strServer, strDatabase, strUser, strPassword); ezsql2.open(); ezsql2.close(); MessageBox.Show(this, "Test Connection string successfully!", "Paradise", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch { MessageBox.Show(this, "Test Connection string failed!", "Paradise", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }