You can use a PreparedStatement, so you don't have to change your code for
every database.

            queryString =
                    "insert into table (column) values (?)";

            preparedStatement = connection.prepareStatement(queryString);

            i = 1;
*           Calendar c = Calendar.getInstance(); // this is for current time
            java.sql.Date d = new java.sql.Date(c.getTimeInMillis());
            preparedStatement.setDate(i++, d);

            insertedRows = preparedStatement.executeUpdate();


Maybe you can change * by
Calendar c = df.getCalendar



> -----Mensaje original-----
> De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> Enviado el: lunes, 15 de septiembre de 2003 9:53
> Para: [EMAIL PROTECTED]
> Asunto: Dateformat for MSSQL DB
> 
> 
> Hello,
> 
> i want to parse a date from a inputfield and write it to DB 
> (MSSQL Server) is there a method to format a date for MSSQL ? 
> or for ODBC Datasources ?
> 
> something like:
> 
> DateFormat df .......,
> date = df.parse() .......
> date = df.FormatForODBC() .....
> 
> 
> Mit freundlichen Grüßen
> 
> Christian Reps, Dipl. Inf. (FH)
> Web Applications
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to