Win a copy of Fixing your Scrum this week in the Agile forum!

Paula Vasseur

Greenhorn
+ Follow
since Feb 16, 2003
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Paula Vasseur

I have written the following code for getting a day, month year and time from a form and inserting this into a table in Access, but always get the
errorjava.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]Datetime field overflow (null)
Also how would I get this code to update a table which already has the date and time inserted into it?
Thanks for your help, this is really cracking me up and am going to throw the computer out the window soon!!!
Slainte Paula
The code is as follows:
<!--bookAppoints.jsp-->
<%--set the content type, import the java.sql classes, include a file containing a page heading--%>
<%@page contentType="text/html"%>
<%@page import="java.sql.*"%>
<%@page import="java.text.*"%>
<%@page import="java.util.Calendar"%>
<%@page import="java.lang.String"%>
<%--start the html--%>
<html>
<body>
<CENTER><H3>Book an appointment H3></CENTER>
<%--set up variables for the sql statement, the connection to the database,
and the results --%>
<%
String driverName = "sun.jdbc.odbc.JdbcOdbcDriver";
String connectionURL = "jdbc dbc:Vet";
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
PreparedStatement ps = null;
int day= 0;
int month = 0;
int year = 0;
int hour = 0;
int mins = 0;
//Calendar c= new Calendar();
Calendar c = Calendar.getInstance();
c.set(year, month, day, hour, mins);
Date appoint_Date = new Date(c.getTime().getTime());
Time appoint_Time = new Time(c.getTime().getTime());
//make the database connection
try{
Class.forName(driverName).newInstance();
con = DriverManager.getConnection(connectionURL);
ps = con.prepareStatement("INSERT INTO appoints1 (appoint_Date, appoint_Time) values (?,?)");
ps.setDate(1, appoint_Date);
ps.setTime(2, appoint_Time);
ps.execute();
if (ps != null) {
ps.close();
}
}
catch (Exception e){
%><%= e %>
<%
}
//print out the results

//close the database
try{
if (con != null) {
con.close();
}
}
catch(Exception e) {%>
<%= e %>
<%
}
%>
<%--close the html --%>
</body>
</html>
I have written the following code for getting a day, month year and time from a form and inserting this into a table in Access, but always get the
errorjava.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]Datetime field overflow (null)
Also how would I get this code to update a table which already has the date and time inserted into it?
Thanks for your help, this is really cracking me up and am going to throw the computer out the window soon!!!
Slainte Paula
The code is as follows:
<!--bookAppoints.jsp-->
<%--set the content type, import the java.sql classes, include a file containing a page heading--%>
<%@page contentType="text/html"%>
<%@page import="java.sql.*"%>
<%@page import="java.text.*"%>
<%@page import="java.util.Calendar"%>
<%@page import="java.lang.String"%>
<%--start the html--%>
<html>
<body>
<CENTER><H3>Book an appointment H3></CENTER>
<%--set up variables for the sql statement, the connection to the database,
and the results --%>
<%
String driverName = "sun.jdbc.odbc.JdbcOdbcDriver";
String connectionURL = "jdbc dbc:Vet";
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
PreparedStatement ps = null;
int day= 0;
int month = 0;
int year = 0;
int hour = 0;
int mins = 0;
//Calendar c= new Calendar();
Calendar c = Calendar.getInstance();
c.set(year, month, day, hour, mins);
Date appoint_Date = new Date(c.getTime().getTime());
Time appoint_Time = new Time(c.getTime().getTime());
//make the database connection
try{
Class.forName(driverName).newInstance();
con = DriverManager.getConnection(connectionURL);
ps = con.prepareStatement("INSERT INTO appoints1 (appoint_Date, appoint_Time) values (?,?)");
ps.setDate(1, appoint_Date);
ps.setTime(2, appoint_Time);
ps.execute();
if (ps != null) {
ps.close();
}
}
catch (Exception e){
%><%= e %>
<%
}
//print out the results

//close the database
try{
if (con != null) {
con.close();
}
}
catch(Exception e) {%>
<%= e %>
<%
}
%>
<%--close the html --%>
</body>
</html>
18 years ago
Thanks very much, got it working, you are a life saver.
Slainte Paula
18 years ago
Hey does anyone know of a good calendar servlet or jsp, I need to be able to click on each date, it register this date and then take me to a corresponding link. It also needs to be able to go up and down in months.
Have been looking but most of the calendars are for inputting data and events, i just want a basic one that I can click on.
Thanks for your help
Paula xxx
18 years ago
I want to enter day, month and year in separate drop down boxes on an Html form, but store these in a DATE column in my database as 12/06/03, how do i convert this, I am using JSPs.
Thanks Paula
18 years ago