Пример #1
0
        private void BtnClickQue(object sender, RoutedEventArgs e)
        {
            data.Clear();
            data.Add(colHead);
            string          sqlStr = "select * from client;";
            MySqlCommand    cmd    = new MySqlCommand(sqlStr, con);
            MySqlDataReader reader = null;

            try {
                reader = cmd.ExecuteReader();
                clientListItem item = new clientListItem();
                while (reader.Read())
                {
                    item.cltID    = reader.GetString("clientID");
                    item.cltName  = reader.GetString("clientName");
                    item.cltPhone = reader.GetString("clientPhone");
                    item.cltAddr  = reader.GetString("clientAddr");


                    item.ctcName  = reader.GetString("contactName");
                    item.ctcPhone = reader.GetString("contactPhone");
                    item.ctcEmail = reader.GetString("contactEmail");
                    item.relation = reader.GetString("relationWithContact");
                    data.Add(new clientListItem(item));
                }
                TxtAlert.Text = "Query success!";
            }
            catch (MySqlException ex) {
                TxtAlert.Text  = "Fail to execute sql command!\nError message: ";
                TxtAlert.Text += ex.Message;
            }
            finally {
                reader.Close();
            }
        }
Пример #2
0
 public void Init(clientListItem item)
 {
     cltID    = item.cltID;
     cltName  = item.cltName;
     cltPhone = item.cltPhone;
     cltAddr  = item.cltAddr;
     ctcName  = item.ctcName;
     ctcPhone = item.ctcPhone;
     ctcEmail = item.ctcEmail;
     relation = item.relation;
 }
Пример #3
0
 public clientListItem(clientListItem item)
 {
     Init(item);
 }