This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design 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