Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa SQL date problem in sql server
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


pradeep
date problem in sql server
1 Answer(s)      4 years and 7 months ago
Posted in : SQL


select count(*) from xxxx_tbl where emplid="+emplid+" and work_dt=#"+work_date+"#"; work_date is in string ,Backend is sql server 2000.i am getting the date problem when using in jsp page.

Advertisement
View Answers

March 31, 2010 at 12:06 PM


Hi Friend,

Try the following code:

retrieveDate.jsp:

<%@page import="java.sql.*"%>
<form method="post" action="retrieveDate.jsp">
<table>
<tr><td>ID</td><td><input type="text" name="id"></td></tr>
<tr><td>Work Date(yyyy-MM-dd)</td><td><input type="text" name="d"></td></tr>
<tr><td><input type="submit" value="Submit"></td></tr>
</table>


<%
String ide=request.getParameter("id");
String date=request.getParameter("d");


String driver = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://localhost:3306/test";;

String GET_RECORD = "select count(*) from d where id='"+ide+"' and myDate='"+date+"'";
ResultSet rs = null;
Connection conn = null;
Statement stmt = null;
try {
Class.forName(driver);
conn=DriverManager.getConnection(url, "root", "root");

stmt = conn.createStatement();
rs = stmt.executeQuery(GET_RECORD);
while (rs.next()) {
out.println("Count =" + rs.getString("count(*)"));
}
rs.close();
stmt.close();
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
%>

Thanks


Related Tutorials/Questions & Answers:
date problem in sql server - SQL
date problem in sql server  select count(*) from xxxx_tbl where emplid="+emplid+" and work_dt=#"+work_date+"#"; work_date is in string ,Backend is sql server 2000.i am getting the date problem when using in jsp page.  
JSF Tomahawk date problem - Java Server Faces Questions
JSF Tomahawk date problem  hi i am working with jsf. I have one doubt reg Tomahawk input Date and Input calender tags. I am trying to get... full details with source code to solve the problem and visit to : http
Advertisements
date range in sql
date range in sql  How can I select a random date from a date range in SQL server
SQL Server
SQL Server  Hii, What is SQL Server ?   hello, SQL Server is a DBMS system provided by Microsoft
sql server - SQL
sql server  what is SQL server? & what is oracle? are they same
sql server - SQL
sql server  How many no of tables can be joined in same sql server
Sql Server - SQL
sql server trigger example  Can any one tell me the live example of triggers in SQL Server?   if u click pistal trigger ,it auotmatically shoot bullet it's like newtons 3rd law (every action s having an equal reaction
php sql problem - SQL
php sql problem  I ahve a php code that doesn't allow me to get the vat value from db. i tried to add $vat = 21; below $shippingCost = 10... NOW() is problem
Data Conversion In Sql Server 2005
Data Conversion In Sql Server 2005  Hi I am working vb.net & sql server 2005 database. I am storing date (MM/DD/YYYY) format. now I have problem in sql date conversion (DD/MM/YYYY). Can you help how to convert date
SQl Date
SQL Date       The SQL Date is used when you are working with dates. This include... The Tutorial illustrate a Example from SQL Date. In this Tutorial, we
Select today's date sql
Select today's date sql   I wanted to show the data from database according to the current date. So, can anyone give me the select today's date sql query? Thanks!   select current date in mysql query select * from
SQL date query
SQL date query  how to get ( 15 march 2011) and (15/03/2011) output using SQL   Use the following queries to get the data from database in the given format. For (15 march 2011) format: SELECT DATE_FORMAT(dob, '%d %M
Multi-Date Handling Problem
Multi-Date Handling Problem  In our project we are using Oracle 10g as our data base, the problem is that we are picking In-date & Out-date from a calendar and on the basis of that date we are checking that on that date some
SQL SERVER 2008
SQL SERVER 2008  when i am fill the all fields in the form.but when i am retrive from the database it shows only firstname,age,address.remaining... wiil be happened here.Tell me the solution for this problem as quickly
XML in SQL Server
XML in SQL Server  Hi..... please anyone tell me about What is the purpose of FOR XML in SQL Server? Thanks
SQL get start date and end date result
SQL get start date and end date result  how to get ( 15 march 2011) and (15/03/2011) output using SQL
SQL Between Date
SQL Between Date       The Tutorial help you to understand SQL Between Date. In this Tutorial..._Table (Stu_Id varchar(2), Stu_Name varchar(15), Stu_Dob date); Insert Data
SQL display date in between query
SQL display date in between query  how to get ( 15 march 2011) and (15/03/2011) output using SQL
Java to SQL Server Connectivity
Java to SQL Server Connectivity  Hi, heres my code private void... with sql server connectivity at the background to save the data. Now, after..._name,cust_nic,cust_contact,cust_address,seat_no,departure_date,amount,total_amount
SQL Date, SQL Date Examples
SQL Date       In this we are going to discuss about the SQL Date functions. SQL stands... will be able to use the SQL Date functions effectively in your program. Here
date problem - Java Beginners
date problem  how to extract day,month,year hours ,second from a string date. Examples: String dat ="200912202934" from this string extract month ,year,date,hours,minute Please help me. Thanks in advance Sushil 
MySql date problem
MySql date problem  with a mysql query, how can you get records of previous week dynamically, starting from sunday and ending on saturday? I don't want records from current date, just the previous week
date problem - Java Beginners
date problem  how to extract day,month,year hours ,second from a string date. Examples: String dat ="200912202934" from this string extract month ,year,date,hours,minute Please help me. Thanks in advance Sushil 
tomcat server problem
tomcat server problem  hello rose india, my name is raju. I am placing a problem with tomcat5.5 server. when i am trying to execute my project I... page is appeared. please resolve my problem as soon as possible. thanking you
problem with the installation of apache-geramio2.1 server
problem with the installation of apache-geramio2.1 server  i have installed Apache Geronimo 2.1 server on my pc,but desired page is not coming on the BROWSER after typing localhost:8080 on the contrary oracle page
Merge databases in SQL SErver 2005
Merge databases in SQL SErver 2005  Please help me to merge databases in SQL server 2005
Sql Server 2008 with textbox
Sql Server 2008 with textbox  **Hi, I tried to insert into DB using textbox in a form using vb by visual studio 2010 but its always catch an error... myconn = New SqlConnection("server=localhost;" & "Initial Catalog=4
Weblogic8 server problem
Weblogic8 server problem  Hi, I am getting following problem while executing client code fro EJB2 in weblogic8 server. Please solve this problem. javax.naming.NameNotFoundException: Unable to resolve 'JLCHelloHomeJNDI
j2me problem - SQL
j2me problem  Hi i hava a j2me (mobile application) having 3 forms each one having 4 fields(text box and dropdown ).i want to get the data from thouse fields, and store into sql data base in my local pc. How intract
server problem - EJB
server problem  Dear sir please give me full deatil how intall jboss5.1.0 and how compile application -ejb,hibernate,spring for admestration console and how intall jboss5.1.0GA server and i not found ant(compiler) thanks
server problem - Hibernate
server problem  dear sir please give me best soloution how run hibernate and spring application on jboss and weblogic10.1.0 sever and compile thanks
 

 

 

DMCA.com