Quantcast
Channel: Active questions tagged servlets - Stack Overflow
Viewing all articles
Browse latest Browse all 721

How to put day month and year in single and double quotes when fetching from database in Java

$
0
0

How to put day, month and year in single and double quotes when fetching from database in Java?

    String first1 = request.getParameter("from_date");    String Second2 = request.getParameter("to_date");    String[] str = first1.split("/");    String[] str1 = Second2.split("/");    int month = Integer.parseInt(str[0]);    int day = Integer.parseInt(str[1]);    int year = Integer.parseInt(str[2]);    int month1 = Integer.parseInt(str1[0]);    int day1 = Integer.parseInt(str1[1]);    int year1 = Integer.parseInt(str1[2]);    System.out.println("From Date :-- Day is:" + day+"-Month is:" + month +"-Year is:" + year);    System.out.println("End Date :-- Day is:" + day1+"-Month is:" + month1 +"-Year is:" + year1);    rs = st.executeQuery("SELECT * FROM frt WHERE (dateinc >= '"+ month +"/" + day +"/" + year"'&& dateinc <='"+ month1 +"/" + day1 +"/" + year1'")");

in this query m not sure...where to put single(') and where to put double quotes ("). please help OR please tell me is it a right way to do it ??????


Viewing all articles
Browse latest Browse all 721

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>