Home Answers Viewqa SQL date problem in sql server

 
 


pradeep
date problem in sql server
1 Answer(s)      3 years and 2 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.
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 Pages:
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.  
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
date range in sql
date range in sql  How can I select a random date from a date range in SQL server
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
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
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
Servlet problem
problem from last three month and now i hope rose india developers... specified" I have latest jdbc connector in server lib dir and also i have... connectivity code it works but problem is with servlet page. My servlet code
SQL Server
SQL Server  Hii, What is SQL Server ?   hello, SQL Server is a DBMS system provided by Microsoft
sql - SQL
full details with source code to solve the problem. Thanks  thnx... at system date& time select * from matchlist where match_DateTime >= getDate() // this results the match list items specifically at system date& time
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
to access a date object - Java Server Faces Questions
to access a date object  How to access a date value from the screen of Visual JSF to the DataBase java-Derby using NetBeans6.5.  Hi friend, For solving the problem visit to : http://www.roseindia.net/jsf/visual
create a xml from sql server 2005 - XML
create a xml from sql server 2005  hello Dear, i want to know how we create a xml file which retrieve data from Sql server 2005 using java. i am briefing my problem as follows. let i have a table in sql server 2005
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
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
SQL Date, SQL Date Examples
SQL Date      ... Date Today in My sql. The Query used in the below example the now... to write the Date Format in SQL Query.    Mysql Date
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 query - SQL
SQL query  hi sir/Madam i am using MS Access where i have table like Fees_Struc: Amount (INT) Due_Date (Date) Fees_Pay: Paid(INT) Student_Bal: Panalty(INT) my problem is when the Due_date is equal
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 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
Using C# DataGridView to insert record into Microsoft SQL Server 2005 database - SQL
Using C# DataGridView to insert record into Microsoft SQL Server 2005 database  Dear Sir, I am new to Microsoft SQL Server 2005. Currently, i'm creating a sales database system using C# and Microsoft SQL Server 2005. I had
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 or UNICODE - SQL
...... I had also change my backhand to SQL SERVER but retrieves same for UNICODE...SQL or UNICODE   Hi again............ I have got something new... their is problem in SENDING and Retrieving the database bcz when trying to fetched ASCII
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
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
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
database - SQL
the problem : 1.Create one more field current_date in the table. 2.First check the current date. 3.If current date found in the table then select the particular question corresponding date. 4.If current date not found the select
SQL
SQL  how to get ( 15 march 2011) and (15/03/2011) output using SQL... format. For (15 march 2011) format: SELECT DATE_FORMAT(dob, '%d %M %Y') FROM patient; For (15/03/2011) format: SELECT DATE_FORMAT(dob, '%d/%m/%Y') FROM
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 
SQL
by most of the database systems including Oracle, Sybase, Microsoft SQL Server... SQL - SQL Introduction     SQL - An Introduction to the Structured Query Language SQL stands for Structured
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
SQL
SQL  how to get ( 15 march 2011) and (15/03/2011) output using SQL... format. For (15 march 2011) format: SELECT DATE_FORMAT(dob, '%d %M %Y') FROM patient; For (15/03/2011) format: SELECT DATE_FORMAT(dob, '%d/%m/%Y') FROM
sql
sql  i need a query for selecting values from a table till a certain date...my database has date in the format '01-JAN-01 12.00.00.000000000 AM
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
SQL
VARCHAR(25) DESIGNATION CHAR(4) JOINING_DATE DATE SALARY... tables EMP, and DEPT, the structure for which are given above. Write SQL queries for the following : Display each employeeâ??s name and date of joining
database - SQL
of the question.It should not get change until date change...   Hi friend, Plz give full details with source code to solve the problem : Thanks
SQL
SQL  what data type we use for the uploading the video and image files in MySQL server 2008
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
Merge databases in SQL SErver 2005
Merge databases in SQL SErver 2005  Please help me to merge databases in SQL server 2005
Problem
refused: connect"   Check that the server (something like EchoServer
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
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
Problem
that the server (something like EchoServer) is up and running.   Thanx i
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
Date operation - JDBC
the html text obj into sql Date obj?  Hi friend, registration...Date operation  The same what i asked already.Still i didnt get the solution.I dont ve any problem while inserting data from jsp to database.My Doubt
jsp sql server 2005 connectivity
jsp sql server 2005 connectivity  your jsp mysql tutorial is very help full.Please tell me how to connect jsp with SQL server 2005

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.