This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "general error?" Watch "general error?" New topic

general error?

Juwles Alco

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:

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);
catch (Exception ex)
Any help would be very much appreciated..
[ November 04, 2005: Message edited by: Bear Bibeault ]
Juwles Alco

Joined: Nov 04, 2005
Posts: 5
Worked it, Primary key problem silly me
I agree. Here's the link:
subject: general error?
Similar Threads
mysql- auto increment
SQL Column Date Type insertion problem
Simple mdb connection Error
insert multiple values into a single column
how to retreive date