on 04-21-2006 7:47 AM
Hi
I have to perform a search in a table:
1. It has Date(java.sql.Date)
2. It has a description field with entry like: "Dual Objective Case to be discussed"
3. other fields.
My issues are:
1. When I try to search for a date, and enter the string "10/10/2005" in the search field and click Search button, even though there are entries, it cannot find it. Mainly because of differences in the date format. I understand java.sql.Date has the format yyyy-mm-dd. How do I resolve this problem?
2. When I give my search term as "Objective", i have to find the entry/entries in which the term "Objective" appears - irrespective of the position of the word in the description sentence. How can I achieve this?
Thanks
Manoj
Hi Manoj,
1. Try extracting the date,month and year from your string "10/10/2005" and use Date class constructor as
Date searchDate = new Date(int year,int month,int date)
2. Get each descriptions in a loop, use indexOf("Objective") function on the description, if the indexOf returns -1 , then it means this particular decription doesnt have Objective. Repeat this for all the descriptions. This is one possible way, but not an efficient one.
Regards,
Uma
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.