private List <string> GetHisIP() { List <string> list = new List <string>(); DataTable dt = Sql_Service.GetHis_IP(); if (dt != null && dt.Rows.Count != 0) { for (int i = 0; i < dt.Rows.Count; i++) { dic[i] = dt.Rows[i]; list.Add(dt.Rows[i]["IP"].ToString()); } } return(list); }
private static ObservableCollection <SelectableViewModel> CreateData() { DataTable dt = Sql_Service.GetHis_IP(); ObservableCollection <SelectableViewModel> lsos = new ObservableCollection <SelectableViewModel>(); foreach (DataRow dr in dt.Rows) { SelectableViewModel aa = new SelectableViewModel(); aa.ID = dr["ID"].ToString(); aa.IP = dr["IP"].ToString(); aa.默认网关 = dr["gateway"].ToString(); aa.子网掩码 = dr["subnet"].ToString(); aa.DNS服务器 = dr["dns"].ToString(); lsos.Add(aa); } return(lsos); }