5.60 /EntityFramework not working steps to reproduce Follow
-
- Posts: 7
- Joined: Thu 08 Apr 2010 16:08
5.60 /EntityFramework not working steps to reproduce Follow
Create a date Datatype in a table in Oracle.
Place the value 1/1/2000 in it.
Using Visual Studio 2008 create a test project and then add a ADO.Net Entity Framweork modle using the DotConnect For Oracle 5.60
Do something like the below.
It will return a count corectly but when you try to foreach it you will get the pasted execption
using (var oEntities = new Entities())
{
var query = from p in oEntities.TTKSMA804100s
select p;
int stuff = query.Count();
// throws the execption here
foreach (TTKSMA804100 c in query)
{
string mycu = c.T_NAME;
}
}
Devart.Data.Oracle.OracleException was unhandled
Message="Year, Month, and Day parameters describe an un-representable DateTime."
Source="Devart.Data.Oracle"
ErrorCode=-2147467259
Code=-1
Offset=0
StackTrace:
at Devart.Data.Oracle.OracleDate.b(Byte[] A_0, Int32 A_1)
at Devart.Data.Oracle.af.g(Byte[] A_0, Int32 A_1, Int32 A_2)
at Devart.Data.Oracle.m.g(Byte[] A_0, Int32 A_1, Int32 A_2)
at Devart.Data.Oracle.OracleDataReader.GetDateTime(Int32 i)
at Devart.Data.Oracle.Entity.k.a.c.a(Int32 A_0)
at Devart.Common.Entity.f.a.a.GetValue(Int32 ordinal)
at System.Data.Common.Internal.Materialization.Shaper.ErrorHandlingValueReader`1.GetValue(DbDataReader reader, Int32 ordinal)
at System.Data.Common.Internal.Materialization.Shaper.GetPropertyValueWithErrorHandling[TProperty](Int32 ordinal, String propertyName, String typeName)
at lambda_method(ExecutionScope , Shaper )
at System.Data.Common.Internal.Materialization.Shaper.HandleEntityAppendOnly[TEntity](Func`2 constructEntityDelegate, EntityKey entityKey, EntitySet entitySet)
at lambda_method(ExecutionScope , Shaper )
at System.Data.Common.Internal.Materialization.Coordinator`1.ReadNextElement(Shaper shaper)
at System.Data.Common.Internal.Materialization.Shaper`1.SimpleEnumerator.MoveNext()
at GTWinTest.Form1.button2_Click(Object sender, EventArgs e) in C:\Users\dkozikow\Documents\Visual Studio 2008\Projects\GTWinTest\GTWinTest\Form1.cs:line 64
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at GTWinTest.Program.Main() in C:\Users\dkozikow\Documents\Visual Studio 2008\Projects\GTWinTest\GTWinTest\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
Place the value 1/1/2000 in it.
Using Visual Studio 2008 create a test project and then add a ADO.Net Entity Framweork modle using the DotConnect For Oracle 5.60
Do something like the below.
It will return a count corectly but when you try to foreach it you will get the pasted execption
using (var oEntities = new Entities())
{
var query = from p in oEntities.TTKSMA804100s
select p;
int stuff = query.Count();
// throws the execption here
foreach (TTKSMA804100 c in query)
{
string mycu = c.T_NAME;
}
}
Devart.Data.Oracle.OracleException was unhandled
Message="Year, Month, and Day parameters describe an un-representable DateTime."
Source="Devart.Data.Oracle"
ErrorCode=-2147467259
Code=-1
Offset=0
StackTrace:
at Devart.Data.Oracle.OracleDate.b(Byte[] A_0, Int32 A_1)
at Devart.Data.Oracle.af.g(Byte[] A_0, Int32 A_1, Int32 A_2)
at Devart.Data.Oracle.m.g(Byte[] A_0, Int32 A_1, Int32 A_2)
at Devart.Data.Oracle.OracleDataReader.GetDateTime(Int32 i)
at Devart.Data.Oracle.Entity.k.a.c.a(Int32 A_0)
at Devart.Common.Entity.f.a.a.GetValue(Int32 ordinal)
at System.Data.Common.Internal.Materialization.Shaper.ErrorHandlingValueReader`1.GetValue(DbDataReader reader, Int32 ordinal)
at System.Data.Common.Internal.Materialization.Shaper.GetPropertyValueWithErrorHandling[TProperty](Int32 ordinal, String propertyName, String typeName)
at lambda_method(ExecutionScope , Shaper )
at System.Data.Common.Internal.Materialization.Shaper.HandleEntityAppendOnly[TEntity](Func`2 constructEntityDelegate, EntityKey entityKey, EntitySet entitySet)
at lambda_method(ExecutionScope , Shaper )
at System.Data.Common.Internal.Materialization.Coordinator`1.ReadNextElement(Shaper shaper)
at System.Data.Common.Internal.Materialization.Shaper`1.SimpleEnumerator.MoveNext()
at GTWinTest.Form1.button2_Click(Object sender, EventArgs e) in C:\Users\dkozikow\Documents\Visual Studio 2008\Projects\GTWinTest\GTWinTest\Form1.cs:line 64
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at GTWinTest.Program.Main() in C:\Users\dkozikow\Documents\Visual Studio 2008\Projects\GTWinTest\GTWinTest\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
-
- Posts: 7
- Joined: Thu 08 Apr 2010 16:08
-
- Posts: 7
- Joined: Thu 08 Apr 2010 16:08
Yes, this is the problem.
.NET Framework DateTime is unable to represent dates not from the 2:00:00 midnight, January 1, 0001 A. D. through 11:59:59 P.M., December 31, 9999 A.D.
More information about DateTime is available here:
http://msdn.microsoft.com/en-us/library ... etime.aspx
I recommend you to change these values in database.
.NET Framework DateTime is unable to represent dates not from the 2:00:00 midnight, January 1, 0001 A. D. through 11:59:59 P.M., December 31, 9999 A.D.
More information about DateTime is available here:
http://msdn.microsoft.com/en-us/library ... etime.aspx
I recommend you to change these values in database.
-
- Posts: 7
- Joined: Thu 08 Apr 2010 16:08