-
Apr 21st, 2015, 08:43 AM
#1
Thread Starter
Fanatic Member
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
-
Apr 21st, 2015, 09:35 AM
#2
Re: No of Records
Are you sure student_id is of type string?
-
Apr 21st, 2015, 09:49 AM
#3
Thread Starter
Fanatic Member
Re: No of Records
yes. i have recreated the field & it is working
Originally Posted by Arnoutdv
Are you sure student_id is of type string?
-
Apr 21st, 2015, 11:23 AM
#4
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
-
Apr 22nd, 2015, 06:36 AM
#5
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|