Literal does not match format string
문제
I am trying to insert data in oracle express 10 g table.
My table contains following Columns:
Field Name Data Type
ATDATE DATE
ATTIME VARCHAR2(5)
EMPNO NUMBER(8)
INOUTIND CHAR(1)
TRTNO CHAR(3)
FLAG NUMBER(2)
STATUS CHAR(1)
LUPDT DATE
Now when I am trying to insert data from my C# Windows application I am getting error
ORA-01861 : literal does not match format string"
So how can I solve it?
I am writing insert command in the Form itself using OracleCommand
.
OracleCommand cmd = new OracleCommand("INSERT INTO TMPATND values(:Atdate,:Attime,:Empno,:Inoutind,:Trtno,:Flag,:Status,:Lupdt)", con);
:Atdate,:Attime etc are parameters. e.g: cmd.Parameters.AddWithValue(":Atdate","20120103");
In which format I should pass the date? ( dd/mm/yyyy or yyyymmdd or others)
해결책
If you perform the insert using parameters, you won't have to worry about the format of the string.
However, if that is not an option, you can use:
myDate.ToString("dd-MMM-yy").ToUpper()
제휴하지 않습니다 StackOverflow