private void buttonSync_Click(object sender, EventArgs e) { try { newList = new List <TransactionSearchModel>(); SqlConnection con = new SqlConnection(textBoxConnectionString.Text); SqlDataAdapter da = new SqlDataAdapter(); DataSet ds = new DataSet(); DataTable dt = new DataTable(); da.SelectCommand = new SqlCommand(@"select * from Output", con); da.Fill(ds, "Output"); dt = ds.Tables["Output"]; foreach (DataRow dr in dt.Rows) { TransactionSearchModel newModel = new TransactionSearchModel(); string tx, rx = string.Empty; tx = dr["Output_Tran_Code"].ToString(); rx = dr["Output_Tran_Stream"].ToString(); if (tx.Length > 6) { newModel.Name = tx.Substring(0, 6); newModel.TX = tx.Substring(0, 6); } if (rx.Length > 62) { newModel.RX = rx.Substring(56, 6); } newList.Add(newModel); } TransactionEnquiry parent = (TransactionEnquiry)this.Owner; parent.updateModel(newList); this.Close(); } catch { } }
private void buttonTransactionEnq_Click(object sender, EventArgs e) { TransactionEnquiry newenquiry = new TransactionEnquiry(); newenquiry.Show(); }