void update_DB() { int current_version; int remote_version; //check current Database index current_version = AccessDBC.version_num(Properties.Settings.Default.LocalDB); if (current_version <= 0) { MessageBox.Show("error in geting currrent DB index"); } else { DB_index.Text = current_version.ToString(); } //check remote Database index remote_version = AccessDBC.version_num(Properties.Settings.Default.RemoteDB); //check if two are the same if (remote_version <= 0 || remote_version == current_version) { //do nothing you are in recent updated verion MessageBox.Show("No Update Happened you are in last index"); } else if (remote_version > current_version) {//here you need to update your database //copy and replace string local_file = Application.StartupPath + "\\SMB.accdb"; string remote_file = Properties.Settings.Default.Remote_file; File.Delete(local_file); File.Copy(remote_file, local_file, true); MessageBox.Show("DataBase update From index: " + DB_index.Text + "to index: " + remote_version.ToString()); DB_index.Text = remote_version.ToString(); } }
private void CB_7_SelectedIndexChanged(object sender, EventArgs e) { List <string> temp_l = new List <string>(); if (!Locker) { AccessDBC aa = new AccessDBC(); aa.Dic_in.Add(CB_1.Tag.ToString(), CB_1.Text); aa.Dic_in.Add(CB_2.Tag.ToString(), CB_2.Text); aa.Dic_in.Add(CB_3.Tag.ToString(), CB_3.Text); aa.Dic_in.Add(CB_4.Tag.ToString(), CB_4.Text); aa.Dic_in.Add(CB_5.Tag.ToString(), CB_5.Text); aa.Dic_in.Add(CB_6.Tag.ToString(), CB_6.Text); aa.Dic_in.Add(CB_7.Tag.ToString(), CB_7.Text); if (CB_7.SelectedIndex > 0 && CB_7.Text != "") { TB_1.Text = aa.GetData(aa.Dic_in, "Capacitorsheet", TB_1.Tag.ToString())[1]; TB_3.Text = aa.GetData(aa.Dic_in, "Capacitorsheet", TB_3.Tag.ToString())[1]; } else { TB_1.Text = ""; TB_3.Text = ""; } } Qty_update(); }
private void CB_6_SelectedIndexChanged(object sender, EventArgs e) { if (!Locker) { if (CB_6.Text == "") { CB_7.DataSource = null; CB_7.Text = ""; } else { AccessDBC aa = new AccessDBC(); aa.Dic_in.Add(CB_1.Tag.ToString(), CB_1.Text); aa.Dic_in.Add(CB_2.Tag.ToString(), CB_2.Text); aa.Dic_in.Add(CB_3.Tag.ToString(), CB_3.Text); aa.Dic_in.Add(CB_4.Tag.ToString(), CB_4.Text); aa.Dic_in.Add(CB_5.Tag.ToString(), CB_5.Text); aa.Dic_in.Add(CB_6.Tag.ToString(), CB_6.Text); List <string> x = new List <string>(); List <double> q = new List <double>(); double pp; x = aa.GetData(aa.Dic_in, "Capacitorsheet", CB_7.Tag.ToString()); q = x.Select(n => !double.TryParse(n, out pp) ? double.NaN : Convert.ToDouble(n)).ToList(); q.Sort(); x = q.Select(c => c == double.NaN || c.ToString() == "NaN"? "" : Convert.ToString(c)).ToList(); x[0] = ""; CB_7.DataSource = x; //data source accept list } } }
private void Form1_Load(object sender, EventArgs e) {//required to define location for database here EIndex = ToExcelC.rowcounts; AccessDBC.connection_str = AccessDBC.Database_LOC("SMB.accdb"); //@@## nead to add database check module that if remote database not reachable close application AccessDBC a = new AccessDBC(); CB_1.DataSource = a.GetData(null, "Capacitorsheet", CB_1.Tag.ToString()); }
private void linkLabel1_LinkClicked_1(object sender, LinkLabelLinkClickedEventArgs e) { AccessDBC a = new AccessDBC(); ToExcelC c = new ToExcelC(); DataTable tablex = new DataTable(); tablex = a.Read_DataSet(null, "Capacitorsheet", "*"); c.ExportToExcel(tablex, "Capacitorsheet"); }
private void CB_3_DropDown(object sender, EventArgs e) { if (CB_3.DataSource == null && CB_1.Text != "" && CB_2.Text != "") { AccessDBC aa = new AccessDBC(); aa.Dic_in.Add(CB_1.Tag.ToString(), CB_1.Text); aa.Dic_in.Add(CB_2.Tag.ToString(), CB_2.Text); CB_3.DataSource = aa.GetData(aa.Dic_in, "Capacitorsheet", CB_3.Tag.ToString());//data source accept list } }
private DataTable Load_data(string order) { AccessDBC a = new AccessDBC(); Dictionary <string, string> z = new Dictionary <string, string>(); z.Add("order", order); DataTable tb = a.Read_DataSet(z, "usersave", "*").Copy(); tb.Columns.Remove("order"); tb.Columns.Remove("ID"); return(tb); }
private void linkLabel5_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { AccessDBC.connection_str = AccessDBC.Database_LOC("SMB.accdb"); AccessDBC a = new AccessDBC(); ToExcelC c = new ToExcelC(); DataTable tablex = new DataTable(); List <string> list = new List <string>() { Des14.Tag.ToString(), Des15.Tag.ToString(), Ref1.Tag.ToString() }; tablex = a.Read_DataSet(null, table.Text, list); c.ExportToExcel(tablex, "Flag Relays"); }
private void CB_1_SelectedIndexChanged(object sender, EventArgs e) { if (!Locker) { if (CB_1.Text == "") { CB_2.DataSource = null; CB_2.Text = ""; } else { AccessDBC aa = new AccessDBC(); aa.Dic_in.Add(CB_1.Tag.ToString(), CB_1.Text); CB_2.DataSource = aa.GetData(aa.Dic_in, "Capacitorsheet", CB_2.Tag.ToString());//data source accept list } } }
private void Save_data(string order) { //here i will create new table and copy table data to it DataTable copytable; copytable = table.Copy(); copytable.Columns.Add("order"); //here i will append order for (int i = 0; i < copytable.Rows.Count; i++) { copytable.Rows[i]["order"] = order; } AccessDBC a = new AccessDBC(); Dictionary <string, string> z = new Dictionary <string, string>(); z.Add("order", order); a.Upload_table(copytable, "usersave", z); }
private void Load_Load(object sender, EventArgs e) { AccessDBC a = new AccessDBC(); CB_Order.DataSource = a.GetData(null, "usersave", "order"); }