Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

general error?

 
Juwles Alco
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I get a "General Error" when I try to Insert values into a table, I would like to avoid preparedstatements at the moment. Does anyone know why this is, I have checked my table names and the that the types conform. My code is below:

try
{
this.setConnection();
Statement st = conn.createStatement();
String sql="INSERT INTO BOOKINGS (BookingID, CustomerID, CarReg, DateBooked, Duration, DateReturned, TotalPrice) VALUES("+"'"+"B100"+"'"+","+" '"+"C101"+"'"+"," +"'"+"T567 TGH"+"'"+","+"'"+"5/11/2005"+"'" +","+"5"+"," +"'"+"10/11/2005"+"'"+","+"50"+")";
int rows = st.executeUpdate(sql);
st.close();
this.closeConnection();
}
catch (Exception ex)
{
System.out.println(ex.getMessage());
}
Any help would be very much appreciated..
Thanks
Julian
[ November 04, 2005: Message edited by: Bear Bibeault ]
 
Juwles Alco
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Worked it, Primary key problem silly me
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic