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



Home Answers Viewqa SQL date problem in sql server

Have Programming Question? Ask it here!
 
 
 


pradeep
date problem in sql server
1 Answer(s)      4 years and 4 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
SQL Server
SQL Server  Hii, What is SQL Server ?   hello, SQL Server is a DBMS system provided by Microsoft
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
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 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
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
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
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 display date in between query
SQL display date in between query  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 
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
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
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
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 
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
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
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
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
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
jdbc odbc sql server exception
jdbc odbc sql server exception  Hi, I am trying to use sql server with java jdbc odbc but I am getting this exception java.sql.SQLException: [Microsoft][SQL Server Native Client 10.0][SQL Server]Incorrect syntax near '@P1
SQL Date
SQL Date         The SQL Date is used when you are working with dates. This include... with Example The Tutorial illustrate a Example from SQL Date. In this Tutorial
Sql Date Conversion
Sql Date Conversion       The Tutorial illustrate an example from 'Sql Date Conversion... of date. This section shows you how to convert date : '2008-12-04
problem regarding tomcat server 6.0
problem regarding tomcat server 6.0  Jul 27, 2012 10:39:19 PM...:\oraclexe\app\oracle\product\10.2.0\server\bin;C:\WINDO WS\system32;C:\WINDOWS;C... starting tomcatserver server command prompt shown this type of description
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
help with JDateChooser to insert date into sql
help with JDateChooser to insert date into sql  TextField3 = new com.toedter.calendar.JDateChooser(); TextField3.setDateFormatString("MM-d-y‚?¶ private void buttonActionPerformed(java.awt.event.Act‚?¶ evt) { try{ DateFormat df
Addintion in year fields of sql date in a java page
Addintion in year fields of sql date in a java page  In my database i have a field StartDate and EndDate Now entering date from my jsp..., HttpServletResponse response) throws ServletException, IOException { Date
connect sql server 2005 using php
connect sql server 2005 using php  how to connect sql server 2005 using php program. how mssql_connect will work
Sql Date and Time Format
Sql Date and Time Format       The Tutorial illustrate an example from the 'Sql Date and Time...; is used to  format date and time.  SYNTAX:- DATE_FORMAT(date,format
Java servlet with jsp on sql server
Java servlet with jsp on sql server  How to delete a user by an admin with check box in Java Servlet with jsp on Sql Server?   Here is a jsp example that can delete the multiple record from the database by selecting
how to connect SQL Server 2005 using php
how to connect SQL Server 2005 using php  i need to connect SQL Server 2005 using php. how can i connect . how to use mssql_connect function
Date Time Problem In Jsp code - Development process
Date Time Problem In Jsp code  Hi Friends, By using this code , am storing date and time into msaccess database. But while retriving i want to get same date and time .send me code for that. SimpleDateFormat
SQL Server Training
SQL Server Training     Microsoft's product SQL Server is a relational database management system (RDBMS.... This SQL Server training course will train you everything like installing SQL
problem on server which works fine on another - Java Server Faces Questions
problem on server which works fine on another  I am having a problem when a tab is clicked, the action listener class is called
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
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
Subtraction of a date from Sql and other from java.
Subtraction of a date from Sql and other from java.  I want to subtract a date that i retrieve from mysql database with the system date that i retrieve from java. I want the difference between the two date in the integer form
Database connection sql server 2005 - JDBC
Database connection sql server 2005  Hi all i am developing an application in struts and i need to connect database for that application using sql server 2005.. can anyone tell me how to make database connection ..plz help me
 

 

 

DMCA.com