aspose file tools*
The moose likes JDBC and the fly likes general error? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "general error?" Watch "general error?" New topic
Author

general error?

Juwles Alco
Greenhorn

Joined: Nov 04, 2005
Posts: 5
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

Joined: Nov 04, 2005
Posts: 5
Worked it, Primary key problem silly me
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: general error?