none
DataTable.Select returns Length=0 RRS feed

  • Question

  • I am having a problem with the DataTable.Select command in one particular instance. I know the data is there yet it is returning no rows.

    This is the command:
    dsincome1.AR_TBL_PatientIncomeOther.Select("OtherInc_EffectiveDate=#8/1/2007#","",dataviewrowstate.Added).Length
    It returns a value of 0.

    Yet if I eliminate the filter, and then check the value, I see it is there:
    dsincome1.AR_TBL_PatientIncomeOther.Select("","",dataviewrowstate.Added)(0)("OtherInc_EffectiveDate")
    It returns a value of #8/1/2007# {Date}

    Does anyone have any ideas?
    Friday, January 18, 2008 4:25 PM

All replies

  • Make sure that row has Added state. What happens if you specify Current instead of Added?

    Monday, January 21, 2008 11:27 AM
    Moderator
  • Try changing it to

    dsincome1.AR_TBL_PatientIncomeOther.Select("OtherInc_EffectiveDate=#8//1//2007#","",dataviewrowstate.Added).Length
    Monday, January 21, 2008 3:35 PM
  • Adding forward slashes to the date in the filter will only cause a FormatException.

     

    Are you sure that the column only contains date information?  If it's a DateTime column, and the time portion isn't zero, the filter expression you're using won't find it.  But "OtherInc_EffectiveDate >= #8/1/2007# and OtherInc_EffectiveDate < #8/2/2007" will.

    Friday, January 25, 2008 12:27 AM