hi, i have a problem when inserting with a data to an oracle table having 2 primary keys.
i'm using Entity Developer for dotConnect to generate Devart LINQ to SQL Model. and Visual Studio 2008
here's my case:
the table:
-----------------------
MyTable
-----------------------
pk1 varchar2(50) //primary key
pk2 varchar2(50) //primary key
Content CLOB
Data BLOB
----------------
the code:
----------------
MyTableDataContext _context = new MyTableDataContext();
MyTable _entity = new MyTable();
_entity.pk1 = "key1";
_entity.pk2 = "key2";
//i do not give value to the other fields and i don't think thats the cause for the problem i have
_context.MyTables.InsertOnSubmit(_entity);
_context.SubmitChanges();
now after i run the code, i get an exception of System.InvalidOperationException : Sequence contains no matching element on _context.MyTables.InsertOnSubmit(_entity);
i wonder what is wrong with my code? the code runs perfectly with tables with 1 primary key.
anyone could help?
Inserting data with 2 Primary keys
-
- Posts: 3
- Joined: Fri 02 Oct 2009 19:09
hello AndreyR, here's the stack trace produced by the Exception:
and i'm using dotConnect for Oracle version 5.25.39
Code: Select all
at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
at Devart.Data.Linq.MultiKeyManager`2.a()
at Devart.Data.Linq.MultiKeyManager`2.a(Type A_0)
at Devart.Data.Linq.MultiKeyManager`2.a(Type A_0)
at Devart.Data.Linq.MultiKeyManager`2.CreateDefault[TType]()
at Devart.Data.Linq.MultiKeyManager`2.CreateKeyFromInstance(T obj)
at Devart.Data.Linq.KeyManager`2.a(Object A_0)
at Devart.Data.Linq.Table`1.a(Object A_0, MetaType A_1)
at Devart.Data.Linq.Table`1.b(Object A_0, MetaType A_1, Dictionary`2 A_2)
at Devart.Data.Linq.Table`1.c(Object A_0, MetaType A_1)
at Devart.Data.Linq.Table`1.InsertOnSubmit(TEntity entity)
at _Default.Page_Load(Object sender, EventArgs e) in c:\Documents and Settings\Tris\My Documents\Visual Studio 2008\WebSites\LintasArta.Humanis\Default.aspx.cs:line 25
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)