public void Init(LoanListItem item) { loanNum = item.loanNum; totalPay = item.totalPay; BName = item.BName; CID = item.CID; }
private void BtnClickQue(object sender, RoutedEventArgs e) { data.Clear(); data.Add(colHead); string sqlStr = "call showLoan();"; MySqlCommand cmd = new MySqlCommand(sqlStr, con); MySqlDataReader reader = null; try { reader = cmd.ExecuteReader(); LoanListItem item = new LoanListItem(); while (reader.Read()) { item.loanNum = reader.GetString(0); item.totalPay = reader.GetString(1); item.BName = reader.GetString(2); item.CID = reader.GetString(3); data.Add(new LoanListItem(item)); } TxtAlert.Text = "Query success!"; } catch (MySqlException ex) { TxtAlert.Text = "Fail to execute sql command!\nError message: "; TxtAlert.Text += ex.Message; } finally { reader.Close(); } }
public LoanListItem(LoanListItem item) { Init(item); }