Closed hasan3ysf closed 9 years ago
I'm not sure how oLines is defined, but it seems that the problem is with second array selection in this expression: oLines[i]['OrderNumber']. Can you just print out those oLines[i]['OrderNumber']? Will that give same error?
From: Hasan Yousef notifications@github.com Sent: Thursday, October 16, 2014 4:24 AM To: aam/oracledart Subject: [oracledart] oracledart: stmt.setInt() and stmt.setString() (#18)
Hi Alex, Can you help in this pls,
I need to insert the below values in oracle table; [{"OrderNumber":83,"LineNumber":"1","Item":"1","Qty":"1","price":"3.2"}]
the table scheme is: ORDERS_ORDERLINES ( OrderID NUMBER, LineID NUMBER, LineNumber NUMBER, ItemID NUMBER, Qty NUMBER, Price NUMBER, DeliveryTermID NUMBER, DeliveryModeID NUMBER, Notes VARCHAR(255), lRDD DATE, deliveredQty NUMBER)
I used this SQL statement:
OracleStatement stmt = oracleConnection.createStatement("""
INSERT INTO ORDERS_ORDERLINES
(OrderID, LineNumber, ItemID, Qty,Price)
VALUES (:1,:2,:3,:4,:5)
""");
stmt.setInt(1, int.parse(oLines[i]['OrderNumber']));
stmt.setInt(2, int.parse(oLines[i]['LineNumber']));
stmt.setInt(3, int.parse(oLines[i]['Item']));
stmt.setInt(4, int.parse(oLines[i]['Qty']));
stmt.setInt(5, int.parse(oLines[i]['price']));
OracleResultset resultset = stmt.executeQuery();
but git this error:
Unhandled exception: Uncaught Error: type 'String' is not a subtype of type 'int' of 'index'. Stack Trace:
thanks
Reply to this email directly or view it on GitHubhttps://github.com/aam/oracledart/issues/18.
Sorry Alex it is my mistake, the oLines are not read correctly, I was missing json.decode to read them properly.
Hi Alex, Can you help in this pls,
I need to insert the below values in oracle table; [{"OrderNumber":83,"LineNumber":"1","Item":"1","Qty":"1","price":"3.2"}]
the table scheme is: ORDERS_ORDERLINES ( OrderID NUMBER, LineID NUMBER, LineNumber NUMBER, ItemID NUMBER, Qty NUMBER, Price NUMBER, DeliveryTermID NUMBER, DeliveryModeID NUMBER, Notes VARCHAR(255), lRDD DATE, deliveredQty NUMBER)
I used this SQL statement:
but git this error:
Unhandled exception: Uncaught Error: type 'String' is not a subtype of type 'int' of 'index'. Stack Trace:
0 _StringBase.
1 savePO... (file:///G:/apps/fonix/server/bin/posthandlers/save_po.dart:37:64)
2 _RootZone.runUnary (dart:async/zone.dart:1082)
3 _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:488)
4 _Future._propagateToListeners (dart:async/future_impl.dart:571)
5 _Future._completeWithValue (dart:async/future_impl.dart:331)
6 _Future._asyncComplete. (dart:async/future_impl.dart:393)
7 _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:41)
8 _asyncRunCallback (dart:async/schedule_microtask.dart:48)
9 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:126)
0 _rootHandleUncaughtError. (dart:async/zone.dart:820)
1 _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:41)
2 _asyncRunCallback (dart:async/schedule_microtask.dart:48)
3 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:126)
thanks