Results 1 to 5 of 5

Thread: No of Records

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2011
    Posts
    688

    No of Records

    Hi

    I gave written the below query but it is returning no record whereas there are 2 records. Value in txtid is 1. Student Id is a string value
    When I remove the trim(txtid.text) condition then it returns 2 records since there are only 2 records at this time with student_id = 1

    str0 = "select * from tbltrans where student_id = '" & Trim(txtid.Text) & "' "
    rsfind.Open str0, cnn1, adOpenStatic, adLockOptimistic

    Thanks

  2. #2
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,854

    Re: No of Records

    Are you sure student_id is of type string?

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2011
    Posts
    688

    Re: No of Records

    yes. i have recreated the field & it is working

    Quote Originally Posted by Arnoutdv View Post
    Are you sure student_id is of type string?

  4. #4
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: No of Records

    So if you recreated the field and it works now then more than likely the answer to the question in post #2 was no and that was the problem.

    That said if you student_ID is numeric as is shown in your first post then the field should be numeric and not a string value. You should have changed your code instead of the field

  5. #5
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    759

    Re: No of Records

    When I remove the trim(txtid.text) condition then it returns 2 records ...
    What does this query return?
    Code:
    select '[' + student_id + ']' as student_id 
    from tbltrans
    Are there any extra spaces in the returned values?
    If so, it might explain why your Trim() is uncovering problems in your data.

    Regards, Phill W.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width