Click here to Skip to main content
15,917,610 members
Home / Discussions / C#
   

C#

 
AnswerRe: Problen : Insert Into Access database Pin
Eddy Vluggen16-Apr-09 2:20
professionalEddy Vluggen16-Apr-09 2:20 
GeneralRe: Problen : Insert Into Access database Pin
Ravindra Bisen16-Apr-09 2:46
Ravindra Bisen16-Apr-09 2:46 
GeneralRe: Problen : Insert Into Access database Pin
Eddy Vluggen16-Apr-09 3:04
professionalEddy Vluggen16-Apr-09 3:04 
QuestionCompile using makefiles. Pin
visserthree16-Apr-09 1:51
visserthree16-Apr-09 1:51 
AnswerRe: Compile using makefiles. Pin
N a v a n e e t h16-Apr-09 2:12
N a v a n e e t h16-Apr-09 2:12 
GeneralRe: Compile using makefiles. Pin
visserthree16-Apr-09 2:16
visserthree16-Apr-09 2:16 
GeneralRe: Compile using makefiles. Pin
visserthree16-Apr-09 3:40
visserthree16-Apr-09 3:40 
QuestionNot a valid month error (ORA-1843) - Oracle "timestamp" column vs .NET DateTime [modified] Pin
devvvy16-Apr-09 1:43
devvvy16-Apr-09 1:43 
Not a valid month error (ORA-1843)
More fun with ODP.NET - Tried different format string none worked!! wasted couple of hours!!

My table column is defined as:
CreateDate timestamp default sysdate NOT NULL

This is first thing I tried (most intuitive right?) This don't work ...
<br />
oParam.DbType = DbType.DateTime;<br />
oParam.Value = DateTime.Now;<br />


Error message in this case was: "ORA-01858: a non-numeric character was found where a numeric was expected"} System.Exception {Oracle.DataAccess.Client.OracleException}


So I tried many things... no luck
<br />
oParam.Value = DateTime.Now.ToString("dd-MMM-yy"); // HH:m:ss<br />
oParam.Value = DateTime.Now.ToString("dd-MM-yy");<br />
oParam.Value = DateTime.Now.ToString("MM-dd-yy");<br />
oParam.Value = DateTime.Now.ToString("MM/dd/yy");<br />
oParam.Value = DateTime.Now.ToString("dd/MM/yy");<br />


Also tried different combinations using MMM, NO LUCK!!

I then Checked db date format via:
select sysdate from dual;

SYSDATE
16-APR-09
1 row selected.


Last trick (Works but UGLY) - use to_date function in my sql statement + string concatenation instead of parameter!!!
select to_date('16-4-09', 'dd-mm-yy') today from dual
Code:
// More special attention for Oracle provider<br/>
if (oContext.DefaultDBProvider == DBUtil.DataProvider.OracleODAC || oContext.DefaultDBProvider == DBUtil.DataProvider.OracleProvider)<br/>
{
// Resort to string concatenation!! Just for Oracle!!

strSQL_insert = strSQL_insert.Replace(ORACLE_CREATEDATE, "to_date('" + DateTime.Now.ToString("dd-MM-yy") + "', 'dd-MM-yy')");
}
// If NOT oracle (other providers), we can do it the proper way!!
else
{
oParam = oCmd.CreateParameter();
oParam.ParameterName = DBUtil.FixParameterNameForOracle(oContext.DefaultDBProvider, "@CreateDate");
oParam.Direction = ParameterDirection.Input;
oParam.DbType = DbType.DateTime;
oCmd.Parameters.Add(oParam);
}


Any suggestion? I've isolated the one offending parameter but need the right "format" and ora messages is not helpful at all.

REF:
http://forums.oracle.com/forums/thre...hreadID=631236
http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx

dev

modified on Thursday, April 16, 2009 9:14 AM

AnswerRe: Not a valid month error (ORA-1843) - Oracle "timestamp" column vs .NET DateTime Pin
Luc Pattyn16-Apr-09 1:54
sitebuilderLuc Pattyn16-Apr-09 1:54 
GeneralRe: Not a valid month error (ORA-1843) - Oracle "timestamp" column vs .NET DateTime Pin
devvvy16-Apr-09 2:12
devvvy16-Apr-09 2:12 
GeneralRe: Not a valid month error (ORA-1843) - Oracle "timestamp" column vs .NET DateTime Pin
devvvy16-Apr-09 2:59
devvvy16-Apr-09 2:59 
GeneralRe: Not a valid month error (ORA-1843) - Oracle "timestamp" column vs .NET DateTime Pin
Luc Pattyn16-Apr-09 3:06
sitebuilderLuc Pattyn16-Apr-09 3:06 
GeneralRe: Not a valid month error (ORA-1843) - Oracle "timestamp" column vs .NET DateTime Pin
devvvy16-Apr-09 3:12
devvvy16-Apr-09 3:12 
GeneralProblem Resolved! Pin
devvvy16-Apr-09 16:29
devvvy16-Apr-09 16:29 
GeneralRe: Problem Resolved! Pin
Luc Pattyn16-Apr-09 16:41
sitebuilderLuc Pattyn16-Apr-09 16:41 
GeneralRe: Problem Resolved! Pin
devvvy16-Apr-09 16:54
devvvy16-Apr-09 16:54 
GeneralRe: Problem Resolved! Pin
Luc Pattyn16-Apr-09 16:56
sitebuilderLuc Pattyn16-Apr-09 16:56 
GeneralRe: Problem Resolved! Pin
devvvy16-Apr-09 17:01
devvvy16-Apr-09 17:01 
Question"ORA-01722: invalid number" - Oracle NUMERIC(19,0) vs .NET long/Int64 Pin
devvvy16-Apr-09 1:34
devvvy16-Apr-09 1:34 
AnswerProblem resolved thanks to Alex Oracle consultant Pin
devvvy16-Apr-09 16:38
devvvy16-Apr-09 16:38 
Questionhow to link a web form to other web form Pin
kapilsahrawat16-Apr-09 1:30
kapilsahrawat16-Apr-09 1:30 
QuestionSearch in Datagridview Pin
RobScripta16-Apr-09 1:13
professionalRobScripta16-Apr-09 1:13 
AnswerRe: Search in Datagridview Pin
musefan16-Apr-09 2:12
musefan16-Apr-09 2:12 
GeneralRe: Search in Datagridview Pin
RobScripta16-Apr-09 3:58
professionalRobScripta16-Apr-09 3:58 
QuestionWindows Service doesn't make event logs on Windows Server 2003 due to insufficient rights Pin
Rocky#16-Apr-09 0:53
Rocky#16-Apr-09 0:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.