Data Reader error when calling insert function

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
jdholbrook
Posts: 1
Joined: Fri 21 Nov 2008 21:01

Data Reader error when calling insert function

Post by jdholbrook » Mon 08 Dec 2008 21:04

Today I created a procedure in my test oracle 10g db to create owners so that I could map it to the insert function for entity:

CREATE OR REPLACE PROCEDURE "EFTEST"."CREATE_OWNER"
(var_fname OWNER.FNAME%TYPE,
var_lname OWNER.LNAME%TYPE)
IS
BEGIN
INSERT INTO OWNER(OWNERID, FNAME, LNAME) VALUES(GET_NEXT_OWNER_ID(), var_fname, var_lname);
end CREATE_OWNER;

My solution compiles, but when I try to create a new owner with the following call:

LunchboxEF context = new LunchboxEF();
context.CREATEOWNER(textboxFName.Text, textboxLName.Text);


I get the error below. Interestingly the database is infact updated even though the app crashes. Any advice would be appreciated:

System.Data.EntityCommandExecutionException was unhandled
Message="The data reader is incompatible with the specified 'Model.OWNER'. A member of the type, 'FNAME', does not have a corresponding column in the data reader with the same name."
Source="System.Data.Entity"
StackTrace:
at System.Data.Query.InternalTrees.ColumnMapFactory.GetMemberOrdinalFromReader(DbDataReader storeDataReader, EdmMember member)
at System.Data.Query.InternalTrees.ColumnMapFactory.GetColumnMapsForType(DbDataReader storeDataReader, EdmType edmType)
at System.Data.Query.InternalTrees.ColumnMapFactory.CreateColumnMapFromReaderAndType(DbDataReader storeDataReader, EdmType edmType, EntitySet entitySet)
at System.Data.Query.InternalTrees.ColumnMapFactory.CreateFunctionImportEntityColumnMap(DbDataReader storeDataReader, FunctionImportMapping mapping, EntitySet entitySet, EntityType baseEntityType)
at System.Data.EntityClient.EntityCommandDefinition.FunctionColumnMapGenerator.System.Data.EntityClient.EntityCommandDefinition.IColumnMapGenerator.CreateColumnMap(DbDataReader reader)
at System.Data.Objects.ObjectContext.CreateFunctionObjectResult[TElement](EntityCommand entityCommand, EntitySet entitySet, EntityType entityType)
at System.Data.Objects.ObjectContext.ExecuteFunction[TElement](String functionName, ObjectParameter[] parameters)
at Lunchbox.LunchboxEF.CREATEOWNER(String vAR_FNAME, String vAR_LNAME) in C:\Data\Development\Wegmans\Distribution\ef-hello\Lunchbox\LunchboxEF.Designer.cs:line 139
at Lunchbox.CreateOwnerForm.buttonCreateOwner_OK_Click(Object sender, EventArgs e) in C:\Data\Development\Wegmans\Distribution\ef-hello\Lunchbox\CreateOwnerForm.cs:line 27
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.RunDialog(Form form)
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at System.Windows.Forms.Form.ShowDialog()
at Lunchbox.Form1.buttonCreateOwner_Click(Object sender, EventArgs e) in C:\Data\Development\Wegmans\Distribution\ef-hello\Lunchbox\Form1.cs:line 105
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 Lunchbox.Program.Main() in C:\Data\Development\Wegmans\Distribution\ef-hello\Lunchbox\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:

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Wed 10 Dec 2008 15:21

Please send me (andreyr * devart * com) your .edmx file containing this procedure. It looks like a mapping error.

dbmdata
Posts: 1
Joined: Wed 14 Jan 2009 17:38

Post by dbmdata » Wed 14 Jan 2009 17:40

I'm getting more or less the same error. The insert actually works, but then the app crashes with the following error:

Test method ModelTest.TESTTABLETest.InsertTestTest threw exception: System.Data.EntityCommandExecutionException: The data reader is incompatible with the specified 'CSRModel.TESTTABLE'. A member of the type, 'ID', does not have a corresponding column in the data reader with the same name..

I know it must be a mapping error somewhere, but I've tried everything I can think of including editing the .edmx file.

Any ideas how to resolve this?

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Thu 15 Jan 2009 08:00

We have emailed you a workaround.

bdtice1
Posts: 1
Joined: Fri 18 Sep 2009 14:11

I am having the same problem

Post by bdtice1 » Fri 18 Sep 2009 14:20

I am having the same issue where the error is the same, but the insert actually works. The only difference is that I am running into this when using the Visual Studio TestTools. AndreyR, could you post the workaround or send it to me?

Thank you

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Mon 21 Sep 2009 13:36

The workaround discussed in this topic is obsolete.
I recommend you to use the approach that is described in our blog post here:
http://devart.com/blogs/dotconnect/?p=5

Post Reply