private void frmProject_Load(object sender, EventArgs e) { try { txtFileName.Text = ""; ComboBox2.Items.Clear(); ComboBox3.Items.Clear(); ComboBox4.Items.Clear(); DGPrj.RowCount = 10; DGPrj.RowTemplate.Height = 30; foreach (DataGridViewColumn colm in DGPrj.Columns) { colm.SortMode = DataGridViewColumnSortMode.NotSortable; } DGPrj[0, 0].Value = "Engine Rated Power (kW):"; DGPrj[0, 1].Value = "@ PTO rpm :"; DGPrj[0, 2].Value = "PTO Rated Torque (Nm):"; DGPrj[0, 3].Value = "@ PTO rpm :"; DGPrj[0, 4].Value = "PTO Flyup RPM:"; DGPrj[0, 5].Value = "PTO Idle RPM:"; DGPrj[0, 6].Value = "PTO Max Torque(Nm):"; DGPrj[0, 7].Value = "Engine Torque Range(1000/2000) Nm:"; DGPrj[0, 8].Value = "PTO Ratio: "; DGPrj[0, 9].Value = "Log PM' Data After Eng.OFF(secs)"; DGPrj.Columns[1].DefaultCellStyle.ForeColor = Color.Red; ComboBox3.Items.Clear(); ComboBox3.Refresh(); Global.Open_Connection("Sequence", "conSeq"); DataTable dt = Global.conSeq.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, "TABLE" }); for (int i = 0; i < dt.Rows.Count; i++) { ComboBox3.Items.Add(dt.Rows[i]["TABLE_NAME"].ToString()); } Global.conSeq.Close(); ComboBox4.Items.Clear(); ComboBox4.Refresh(); Global.Open_Connection("Limit", "conLim"); dt = Global.conLim.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, "TABLE" }); for (int i = 0; i < dt.Rows.Count; i++) { ComboBox4.Items.Add(dt.Rows[i]["TABLE_NAME"].ToString()); } Global.conLim.Close(); Global.Open_Connection("General", "con"); Adp = new MySqlDataAdapter("SELECT * FROM tblEngine", Global.con); ds = new DataSet(); Adp.Fill(ds); int x = 0; ComboBox2.Items.Clear(); for (x = 0; x <= (ds.Tables[0].Rows.Count - 1); x++) { ComboBox2.Items.Add(ds.Tables[0].Rows[x].ItemArray[0]); } ds.Dispose(); Adp.Dispose(); Global.Open_Connection("General", "con"); Adp = new MySqlDataAdapter("Select * from tblProject", Global.con); ds = new DataSet(); Adp.Fill(ds); PrjGV.DataSource = ds.Tables[0]; PrjGV.Columns[0].Width = 100; PrjGV.Columns[1].Width = 100; PrjGV.Columns[2].Width = 100; PrjGV.Columns[3].Width = 100; PrjGV.Columns[4].Width = 100; PrjGV.Columns[5].Width = 100; PrjGV.Columns[6].Width = 60; PrjGV.Columns[7].Width = 60; PrjGV.Columns[8].Width = 60; PrjGV.Columns[9].Width = 60; PrjGV.Columns[10].Width = 60; PrjGV.Columns[11].Width = 60; PrjGV.Columns[12].Width = 60; PrjGV.Columns[13].Width = 60; PrjGV.Columns[14].Width = 60; PrjGV.Columns[15].Width = 60; foreach (DataGridViewColumn colm in PrjGV.Columns) { colm.SortMode = DataGridViewColumnSortMode.NotSortable; } Adp.Update(ds.Tables[0]); Load_InCell(); } catch (Exception ex) { MessageBox.Show("Error Code:-11001 " + ex.Message); } }
private void frmProject_Load(object sender, EventArgs e) { try { ComboBox1.Items.Clear(); ComboBox2.Items.Clear(); ComboBox3.Items.Clear(); ComboBox4.Items.Clear(); DGPrj.RowCount = 10; DGPrj.RowTemplate.Height = 30; foreach (DataGridViewColumn colm in DGPrj.Columns) { colm.SortMode = DataGridViewColumnSortMode.NotSortable; } DGPrj[0, 0].Value = "Engine Rated Power (kW):"; DGPrj[0, 1].Value = "@ Engine rpm :"; DGPrj[0, 2].Value = "Engine Rated Torque (Nm):"; DGPrj[0, 3].Value = "@ Engine rpm :"; DGPrj[0, 4].Value = "Engine Flyup RPM:"; DGPrj[0, 5].Value = "Engine Idle RPM:"; DGPrj[0, 6].Value = "Engine Start RPM:"; DGPrj[0, 7].Value = "Engine Start plus Duration(s)"; DGPrj[0, 8].Value = "Engine Cummulative (hr.mm):"; DGPrj[0, 9].Value = "Log PM' Data After Eng.OFF(secs)"; DGPrj.Columns[1].DefaultCellStyle.ForeColor = Color.Red; ComboBox3.Items.Clear(); ComboBox3.Refresh(); Global.Open_Connection("seq_db", "conSeq"); MySqlCommand cmd = new MySqlCommand("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='seq_db'", Global.conSeq); using (MySqlDataReader reader = cmd.ExecuteReader()) { ComboBox3.Items.Clear(); while (reader.Read()) { ComboBox3.Items.Add((string)reader["TABLE_NAME"]); } reader.Dispose(); } cmd.Dispose(); Global.conSeq.Close(); ComboBox3.SelectedIndex = 0; //---------------------------------- ComboBox4.Items.Clear(); ComboBox4.Refresh(); Global.Open_Connection("lim_db", "conLim"); MySqlCommand cmd1 = new MySqlCommand("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA = 'lim_db'", Global.conLim); using (MySqlDataReader reader = cmd1.ExecuteReader()) { ComboBox4.Items.Clear(); while (reader.Read()) { ComboBox4.Items.Add((string)reader["TABLE_NAME"]); } reader.Close(); } cmd1.Dispose(); Global.conLim.Close(); ComboBox4.SelectedIndex = 0; Global.Open_Connection("gen_db", "con"); Adp = new MySqlDataAdapter("SELECT * FROM tblEngine", Global.con); ds = new DataSet(); Adp.Fill(ds); int x = 0; ComboBox2.Items.Clear(); for (x = 0; x <= (ds.Tables[0].Rows.Count - 1); x++) { ComboBox2.Items.Add(ds.Tables[0].Rows[x].ItemArray[0]); } ds.Dispose(); Adp.Dispose(); Global.Open_Connection("gen_db", "con"); Adp = new MySqlDataAdapter("Select * from tblProject", Global.con); ds = new DataSet(); Adp.Fill(ds); PrjGV.DataSource = ds.Tables[0]; PrjGV.Columns[0].Width = 100; PrjGV.Columns[1].Width = 100; PrjGV.Columns[2].Width = 100; PrjGV.Columns[3].Width = 100; PrjGV.Columns[4].Width = 100; PrjGV.Columns[5].Width = 100; PrjGV.Columns[6].Width = 60; PrjGV.Columns[7].Width = 60; PrjGV.Columns[8].Width = 60; PrjGV.Columns[9].Width = 60; PrjGV.Columns[10].Width = 60; PrjGV.Columns[11].Width = 60; PrjGV.Columns[12].Width = 60; PrjGV.Columns[13].Width = 60; PrjGV.Columns[14].Width = 60; PrjGV.Columns[15].Width = 60; foreach (DataGridViewColumn colm in PrjGV.Columns) { colm.SortMode = DataGridViewColumnSortMode.NotSortable; } Adp.Update(ds.Tables[0]); Load_InCell(); } catch (Exception ex) { Global.Create_OnLog("ex.Message .........", "Alart"); return; //MessageBox.Show ("Error Code:-11001 " + ex.Message); } }