Last post Mar 31, 2009 11:20 AM by Dilal
Mar 29, 2009 08:34 PM|Dilal|LINK
Input string was not in a correct format.Couldn't store <999.00> in iWeeklyOrderDataID Column.
Expected type is Int32.
How do i correctly take my values from data table to database? THANKS!
i'm taking data from excel into data table. i then have stored procedure that does an insertion to database.
in excel i have 5 columns. and the values for the first 2 columns are (999.00 & 222.00) and the next 2 values are int (100, 200) and 5th one 333.00
columns: GrossOrderValue, AcceptedOrderValue, NumberGrossOrders, NumberAcceptedOrders, OrdersExistingCustomers
my SP is like this:
iGrossOrderValue = numeric(18, 2)
iAcceptedOrderValue = numeric(18, 2)
iNumberGrossOrders = int
iNumberAcceptedOrders = int
iPercentExistentClients = numeric(6, 2)
Mar 29, 2009 10:46 PM|Naom|LINK
What is your insert command? Just in case you can also add CAST in insert command to cast to int.
Mar 30, 2009 07:26 AM|Dilal|LINK
thanks for getting back. it seems the problem isnt with casting. as im taking data from csv its trying to insert data into wrong columns hence the problem. my SP parameters in code is lke this.
Mar 30, 2009 10:48 AM|tatsky|LINK
Could you possibly post the content of your SP too? as your parameter definitions look fine at first glance, so I would be interested in seeing how you have implimented your stored procedure.
This may be a silly question, but have you tried calling your SP manually to ensure it works correctly? ie
exec MyInsertSproc @MerchantID=x, ... etc
Mar 31, 2009 11:20 AM|Dilal|LINK
my loop and casting was not done properly. fixed now. thanks again.