public frmDatabase(Server server) { // Information that is used to connect to the MySql Database string dbhost = "localhost"; string dbuser = "******"; string dbpass = "******"; string dbdatabase = "dataman"; // The server connection that is used to connect to the database. this.server = server; // Creates all the controls for the form. InitializeComponent(); // Checks to make sure the connection to the server is still active and then // attempts to connect to the database. if (server.isJschConnected()) { this.statLbl1.Text = "Connected To Server"; server.setPortForwarding("131-server.ecs.csus.edu"); mySqlConn = new SqlDatabase(dbhost, dbuser, dbpass, dbdatabase); data = new DataTable(); data = mySqlConn.queryDatabase("show tables;"); fillDataGrid(data); } }
public frmController(Server server) { // Information that is used to connect to the MySql Database string dbhost = "localhost"; string dbuser = "******"; string dbpass = "******"; string dbdatabase = "dataman"; // The server connection that is used to connect to the database. this.server = server; // Creates all the controls for the form. InitializeComponent(); // Checks to make sure the connection to the server is still active and then // attempts to connect to the database. if (server.isJschConnected()) { this.statLbl1.Text = "Connected To Server"; server.setPortForwarding("131-server.ecs.csus.edu"); mySqlConn = new SqlDatabase(dbhost, dbuser, dbpass, dbdatabase); // Will return the result of trying to connect to the database. Will have // a null string if it was able to connect. string result = mySqlConn.connectDatabase(); if (result == null) { if ( rdoDatabase.Checked ) { loadDatabaseAccounts(); } else if ( rdoProject.Checked ) { loadProjectAccounts(); } } else { MessageBox.Show(result, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } // Defaults the combo box to unsynced. this.cmboAcctStatus.SelectedIndex = 0; } }
public frmDatabase(Server server) { // Information that is used to connect to the MySql Database string dbhost = "131-server.ecs.csus.edu"; string dbuser = "******"; string dbpass = "******"; string dbdatabase = "dataman"; // The server connection that is used to connect to the database. this.server = server; // Creates all the controls for the form. InitializeComponent(); // Checks to make sure the connection to the server is still active and then // attempts to connect to the database. if (server.isJschConnected()) { this.statLbl1.Text = "Connected To Server"; server.setPortForwarding(dbhost); mySqlConn = new SqlDatabase(dbhost, dbuser, dbpass, dbdatabase); // Will return the result of trying to connect to the database. Will have // a null string if it was able to connect. string result = mySqlConn.connectDatabase(); if (result == null) { data = new DataTable(); data = mySqlConn.queryDatabase("show tables;"); fillDataGrid(data); } else { MessageBox.Show(result, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } } }