Click here to Skip to main content
15,913,709 members

Comments by Sushil 07101990 (Top 5 by date)

Sushil 07101990 13-Nov-13 12:11pm View    
No its already updated.

Kindly provide some other solution
Sushil 07101990 11-Nov-13 11:51am View    
Dear Nagy,

As per your above code, I implemented the same in my code which looks likes below:-

private boolean enterDataIntoMSAccessDatabaseusingPreparedStatement()
{
try {

ps = connection.prepareStatement("INSERT INTO Cart ID Details VALUES (?,?,?,?,?,?,?)");

System.out.println("After Query");

}

catch (SQLException se) {

generateErrorMessage("Error in Prepared Statement \n " + se.getMessage() );

return false;

}

catch (Exception e)
{
generateErrorMessage("Unexpected Error Occured \n " + e.getMessage());
}

String todaysDate = cartIDApplicationAddCartIDDatejTextField.getText().trim();

String cartID = cartIDApplicationAddCartIDCartIDjTextField.getText().trim();

String clientName = cartIDApplicationAddCartIDClientNamejTextField.getText().trim();

String teamSegment = cartIDApplicationAddCartIDTeamAndSegmentjTextField.getText().trim();

String duration = cartIDApplicationAddCartIDDurationjTextField.getText().trim();

String tapeID = cartIDApplicationAddCartIDTapeIDjTextField.getText().trim();

String startDate = cartIDApplicationAddCartIDStartDatejTextField.getText().trim();

String endDate = cartIDApplicationAddCartIDEndDatejTextField.getText().trim();

try {

System.out.println("Before ps.setString()");

SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-mm-dd", Locale.ENGLISH);
System.out.println("Simple Date Format");

/*ps.setString(1, todaysDate);
ps.setString(2, cartID );
ps.setString(3, clientName);
ps.setString(4, teamSegment);
ps.setString(5, duration);
ps.setString(6, tapeID);
ps.setString(7, startDate);
ps.setString(8, endDate);*/

ps.setDate(1, new java.sql.Date(simpleDateFormat.parse(todaysDate).getTime()));
ps.setString(2, cartID);
ps.setString(3, clientName);
ps.setString(4, teamSegment);
ps.setString(5, duration);
ps.setString(6, tapeID);
ps.setDate(7, new java.sql.Date(simpleDateFormat.parse(startDate).getTime()));
ps.setDate(8, new java.sql.Date(simpleDateFormat.parse(endDate).getTime()));

System.out.println("After ps.setString()");

ps.executeUpdate();


}
catch (SQLException se) {

generateErrorMessage("Error while inserting data in database \n " + se.getMessage());

return false;
}

catch (Exception e)
{
generateErrorMessage("Unexpected Error Occured \n" + e.getMessage() );
}

return true;
}

I got below error after implementing the above code:-

Unexpected Error Occured
Unparseable date: "11-Nov-2013"

Kindly help me for the same.
Sushil 07101990 3-Oct-13 12:52pm View    
I don't know how to implement the same. Can you explain the same shortly ?
Sushil 07101990 3-Oct-13 5:39am View    
After Commenting Class.forName(driverName).newInstance() I am getting following Runtime Exception:-

jdbc:sqlserver://192.168.69.189:1433;instance=MSRS11.MSSQLSERVER;DatabaseName=Ra
diocity_Central;integratedSecurity=true
java.sql.SQLException: No suitable driver found for jdbc:sqlserver://192.168.69.
189:1433;instance=MSRS11.MSSQLSERVER;DatabaseName=Radiocity_Central;integratedSe
curity=true
at java.sql.DriverManager.getConnection(DriverManager.java:602)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at ConnectDatabase.getConnection(ConnectDatabase.java:23)
at ConnectDatabase.main(ConnectDatabase.java:51)

What to do now ?
Sushil 07101990 2-Oct-13 7:22am View    
How to add it & what is the use of same?