p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/)
-   Oracle ASP (http://p2p.wrox.com/oracle-asp-106/)
-   -   DataAdapter.Update Oracle Errors (http://p2p.wrox.com/oracle-asp/81590-dataadapter-update-oracle-errors.html)

tcraig04 November 15th, 2010 07:44 PM

DataAdapter.Update Oracle Errors
 
Hi all,

I am having an issue with uploading a dataset to an oracle table. It appears to be associated with the date field that i am attempting to pass in. If i attempt to pass in with a valid formatted DateTime (mm/dd/yyyy) it send an oracle error "Not a Valid Month". If i update this to show as either MON or MONTH format and pass in that value, i receive oracle error "a non-numeric character was found where a numeric was expected".

Please help! I have pasted some of the code below:
--------------------------------------------------
ASP.NET code

Database dbOracle = new Database();
OracleCommand cmdOra = new OracleCommand(StoredProceduresNames.InsertData, dbOracle.OConnection);
cmdOra.CommandType = CommandType.StoredProcedure;
OracleDataAdapter da = new OracleDataAdapter();

//Add the sales date field
cmdOra.Parameters.Add(DetailParameters.SalesDate, OracleDbType.Date, 12, Column.SALES_MM_YY);

da.InsertCommand = cmdOra;
da.Update(dsDataSet, dtDataTable);
---------------------------------------------------
Oracle Sproc code

PROCEDURE INSERT_VALUES
(
v_SALES_DATE IN DATE
)
IS
BEGIN

INSERT INTO TABLE
(
SALE_DT
)
VALUES
(
v_SALES_DATE
);
END;

tcraig04 November 16th, 2010 03:17 PM

I was able to fix this issue by converting my DateTime to a dd MMM yyyy string format and passing that value in. Oracle can then convert this string into the correct DateTime in the database.


All times are GMT -4. The time now is 08:59 AM.

Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
2013 John Wiley & Sons, Inc.