c# - Format a date so it can be written into Oracle ("Not a valid month" error) -
having trouble finding proper syntax this. here's field on asp side:
<input type="text" id="ei_open_auditstartdt" class="datepicker" runat="server" name="ei_open_auditstartdt" value='<%#eval("audit_start_date") %>' style="width: 100px" />
here's part of code-behind in c#:
htmlinputtext ei_open_auditstartdt = (htmlinputtext)datagrid_open.rows[e.rowindex].findcontrol("ei_open_auditstartdt"); textbox ei_open_transcit = (textbox)datagrid_open.rows[e.rowindex].findcontrol("ei_open_transcit"); string startdt = string.format("{0:dd-mmm-yyyy}", ei_open_auditstartdt.value); string transcit = ei_open_transcit.text; datagrid_rootcauses.editindex = -1; oracleconnection conn = getconnection(); try { using (oraclecommand cmd = new oraclecommand("cst_amr_write_openstatus", conn)) { cmd.commandtype = commandtype.storedprocedure; using (oracledataadapter da = new oracledataadapter(cmd)) { cmd.parameters.addwithvalue("v_startdt", oracletype.datetime).value = startdt; cmd.parameters.addwithvalue("v_transcit", oracletype.varchar).value = transcit;
the problem is, when gets string startdt, still sees value as, say, "03/24/2017" instead of "24-mar-17", i'm getting "not valid month" error.
can see i'm doing wrong?
verify format of data stored in oracle db.
attempt insert data raw string, in format , see if succeeds.
that takes calling code out of possible variables affecting problem.
if still doesn't work, have @ stored procedure , figure out if it's converting formats without knowledge.
if don't have ability see stored procedure, going have try bunch of different formats in calling code until find right one.
Comments
Post a Comment