on 12-15-2006 9:30 AM
Dear SDN's,
I am trying to insert the records into sql server through my webDynpro program.
I have created a date field in a dictionary with the datatype date.
In my webdynpro program to insert the date i am following the below format.
String dateString = "2006/12/10";
java.util.Date d=new java.util.Date(dateString);
java.sql.Date <b>date</b> = new java.sql.Date(d.getTime());
int i=stmt.executeUpdate("INSERT INTO TRAVEL_HEADER(TRQID,PROJECTID,<b>REQDT</b>,ADVCE,ETADV,PURTR) values(21, '555-1212', '" + <b>date</b> + "', 5000, '20060501','hi')");
when i try to execute it, it gives the following error.
<b>com.sap.sql.log.OpenSQLException: The SQL statement "INSERT INTO "TRAVEL_HEADER" ("TRQID","PROJECTID","REQDT","ADVCE","ETADV","PURTR") VALUES (21,'555-1212','2006-12-10',5000,'20060501','hi')" contains the semantics error[s]: - type check error: new value (element number 3 (CHAR)) is not assignable to column >>REQDT<< (DATE)</b>
Please correct me.
Your help will be appreciated.
Regards,
Sireesha.B
Try using
int i=stmt.executeUpdate("INSERT INTO TRAVEL_HEADER(TRQID,PROJECTID,REQDT,ADVCE,ETADV,PURTR) values(21, '555-1212', " + date + ", 5000, '20060501','hi')");
Regards, Anilkumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.