日期:2014-05-18 浏览次数:20817 次
/// <summary> ///根据条件查询是否有在指定范围内的记录 /// </summary> /// <param name="a"></param> /// <param name="b"></param> /// <param name="c"></param> /// <returns></returns> private DataRow[] Select_(double a,double b,double c) { try { double Big_b_FW = b + 0.006; double Big_a_FW = a + 0.006; double Small_b_FW = b - 0.006; double Small_a_FW = a - 0.006; double Big_c_FW = c + 50.0; double Small_c_FW = c - 50.0; DataRow[] dr = DS_PointInfo.Tables[0].Select("a < " + Big_a_FW.ToString() + "And a > " + Small_a_FW.ToString() + "AND b > " + Small_b_FW.ToString() + "AND b < " + Big_b_FW.ToString() + "AND c < " + Big_c_FW.ToString() + "AND c > " + Small_c_FW.ToString()); return dr; } catch(Exception err) { MessageBox.Show(err.ToString()); return null; } }
/// <summary> ///根据条件查询是否有在指定范围内的记录 /// </summary> /// <param name="a"></param> /// <param name="b"></param> /// <param name="c"></param> /// <returns></returns> private DataRow[] Select_JWD(double a,double b,double c) { try { double Big_a_FW = a + 0.006; double Small_a_FW = a - 0.006; double Big_b_FW = b + 0.006; double Small_b_FW = b - 0.006; double Big_c_FW = c + 50.0; double Small_c_FW = c - 50.0; DataRow[] dr = DS.Tables[0].Select("b > " + Small_b_FW.ToString() + " AND b < " + Big_b_FW.ToString()); if (dr.Length > 0) { DataTable DATAT = new DataTable(); DATAT = DS.Tables[0].Clone(); for (int i = 0; i < dr.Length; i++) { DATAT.Rows.Add(dr[i].ItemArray); } DataRow[] dr1 = DATAT.Select("a > " + Small_a_FW.ToString() + " AND a < " + Big_a_FW.ToString()); if (dr1.Length > 0) { DATAT.Rows.Clear(); DATAT = DS.Tables[0].Clone(); for (int i = 0; i < dr.Length; i++) { DATAT.Rows.Add(dr[i].ItemArray); } DataRow[] dr2 = DATAT.Select("c > " + Small_c_FW.ToString() + " AND c < " + Big_c_FW.ToString()); return dr2; } else { return dr1; } } else { return dr; } } catch(Exception err) { MessageBox.Show(err.ToString()); return null; } }