private void Form1_Load(object sender, EventArgs e) { SourceNa = Dns.GetHostName(); webBrowser1.ShowPageSetupDialog(); webBrowser1.ShowSaveAsDialog(); Dbconnection = new DBCON(); //RETRIEVE TABLES THROUGH QUERY Query = "select table_name from INFORMATION_SCHEMA.Tables order by Table_type"; //TO READ DATABASES AND SUB-DATABASES dataset = new DataSet(); table = Dbconnection.ExecuteQuery(Query); actc = new ActionController(); // textBox1.Text = "machine16"; foreach (DataRow drow in table.Rows) { comboTablename.Items.Add(drow.ItemArray.GetValue(0).ToString()); } }
//TO GET ALL DATAS FROM DATABASE public void assignpartition(string tablename) { dbconnection1 = new DBCON(); Query = "select * from " + tablename + ""; table = dbconnection1.ExecuteQuery(Query); TableN = tablename; arryColumnName.Clear(); rowscount = table.Rows.Count; rowscountStatic = rowscount; using (StreamWriter sw = new StreamWriter(dirname + "\\Txt.txt")) { foreach (DataRow drow1 in table.Rows) { int j2 = drow1.Table.Columns.Count; strbldr = new StringBuilder(); for (int m = 0; m < j2; m++) { strbldr.Append(drow1.ItemArray.GetValue(m).ToString() + " "); } sw.WriteLine(strbldr); } } foreach (DataColumn colo in table.Columns) { arryColumnName.Add(colo + "-" + colo.DataType.Name); } //TO CREATE THE NUMBER OF PARTITION partitionvalue = rowscount / 3; int i = 0; Hashpartition = new Hashtable[partitionvalue]; for (i = 0; i < partitionvalue; i++) { Hashpartition[i] = new Hashtable(); } foreach (DataRow drow in table.Rows) { rowscount1 = rowscount1 + 1; // pkey = int.Parse(drow.ItemArray.GetValue(0).ToString()); //TO GET PARTITION NUMBER(PRIMARYKEY,SECRETKEY & NUMBER OF PARTITION) partitionnum = this.getpartitionnum(rowscount1, MainForm.secretkey, partitionvalue); if (!PartionArry.Contains(partitionnum)) { PartionArry.Add(partitionnum); } // Name = drow.ItemArray.GetValue(1).ToString(); //Age = drow.ItemArray.GetValue(2).ToString(); Hashpartition[partitionnum].Add(Hashpartition[partitionnum].Count, rowscount1 + "~" + KeyAdd(drow) + "~" + count); count++; } partCount = PartionArry.Count; ReadWrite(Hashpartition); MessageBox.Show("Data Collected", "Server", MessageBoxButtons.OK); singlebit.Encode(Hashpartition, PartionArry, arryColumnName); }