private void Button_Click_4(object sender, RoutedEventArgs e) { MysqlContentTool.Ins.ConnStr = "server=127.0.0.1;port=3306;user=root;password=1111111111a; database=uisrnns;"; string sql = @"SELECT COUNT(UKEY) from cnt_exclude"; List <MySqlParameter> Paramter = new List <MySqlParameter>(); DataSet dt = MysqlContentTool.Ins.ExecuteDataSet(sql, Paramter.ToArray()); textBlock1.Text = dt.Tables[0].Rows[0][0].ToString(); int num = lingTaskQueue.getLingTaskQueuer().Size(); if (num != 0) { try { labeltask1.Content = lingTaskQueue.getLingTaskQueuer().Gethead().Value.ToString(); } catch { labeltask1.Content = "出现异常"; } try { labeltime1.Content = lingTaskQueue.getLingTaskQueuer().Gethead().Key.ToString();; } catch { labeltime1.Content = "出现异常"; } } else { labeltask1.Content = labeltime1.Content = "队列为空"; } textBlock_jiahua.Text = num.ToString(); }
private List <KeyValuePair <string, string> > built() // 输出 地址 时间 { List <KeyValuePair <string, string> > list = new List <KeyValuePair <string, string> >(); LingTaskQueuer ling = lingTaskQueue.getLingTaskQueuer(); for (int i = 0, j = ling.Size(); i < j; i++) { KeyValuePair <DateTime, string> at = ling.At(i); MysqlContentTool.Ins.ConnStr = "server=127.0.0.1;port=3306;user=root;password=1111111111a; database=uisrnns;"; string sql = @"select Location from cnt_bell where RouterID=(select RouterID from cnt_router where IP=@ip)"; List <MySqlParameter> Paramter = new List <MySqlParameter>(); Paramter.Add(new MySqlParameter("@ip", at.Value)); DataSet dt = MysqlContentTool.Ins.ExecuteDataSet(sql, Paramter.ToArray()); string msg = (dt.Tables[0].Rows[0])[dt.Tables[0].Columns[0]].ToString(); list.Add(new KeyValuePair <string, string>(msg, at.Key.ToString())); } return(list); }