<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>ASP.NET 3.5 Extensions Preview</title><link>http://forums.asp.net/1147.aspx</link><description>Setup issues and general questions regarding this release. For specific topics use &lt;a href="http://forums.asp.net/1146.aspx"&gt;ASP.NET MVC&lt;/a&gt;, &lt;a href="http://forums.asp.net/1154.aspx"&gt;ASP.NET Controls for Silverlight&lt;/a&gt;, &lt;a href="http://forums.asp.net/1145.aspx"&gt;ASP.NET Dynamic Data&lt;/a&gt;, &lt;a href="http://go.microsoft.com/fwlink/?linkid=96773"&gt;ADO.NET Entity Framework&lt;/a&gt;, &lt;a href="http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=1430&amp;SiteID=1"&gt;ADO.NET Data Services&lt;/a&gt; or the &lt;a href="http://forums.asp.net/1008.aspx"&gt;ASP.NET AJAX UI&lt;/a&gt; forum.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: how to save data to relationship table with LINQ to SQL?</title><link>http://forums.asp.net/thread/3261485.aspx</link><pubDate>Sat, 27 Jun 2009 07:38:20 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3261485</guid><dc:creator>maverickhyd</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3261485.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1147&amp;PostID=3261485</wfw:commentRss><description>&lt;p&gt;In LINQ to SQL, all your entities should have a primary key column defined. If you don&amp;#39;t define an entity without a primary key, you can only fetch its instances from database. You won&amp;#39;t be able to make any changes to it. This is mainly because LINQ to SQL uses an Identity-Map to cache and keep track of the entities it is managing.&lt;/p&gt;
&lt;p&gt;Check this&lt;/p&gt;
&lt;p&gt;&lt;a href="http://social.msdn.microsoft.com/Forums/en-US/linqtosql/thread/f3b216d2-fa06-49a1-a901-11702e80b38c"&gt;http://social.msdn.microsoft.com/Forums/en-US/linqtosql/thread/f3b216d2-fa06-49a1-a901-11702e80b38c&lt;/a&gt;&lt;/p&gt;</description></item><item><title>how to save data to relationship table with LINQ to SQL?</title><link>http://forums.asp.net/thread/3260792.aspx</link><pubDate>Fri, 26 Jun 2009 17:54:15 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3260792</guid><dc:creator>KentZhou</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3260792.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1147&amp;PostID=3260792</wfw:commentRss><description>&lt;p&gt;Suppose I have three tables: Tab1(Cola, ,,,,) Tab2(Colb,....), tab3(cola, colb,...)&lt;/p&gt;&lt;p&gt;Cola is primiary key for tab1, colb is primary key for tab2.&amp;nbsp; Tab3 is a relationship of tab1 and tab2, so cola, colb is foreign keys for tab3.&lt;/p&gt;&lt;p&gt;For tab1 and tabl2, becuase thery are entity, so I can use datacontext db to add a new instance like:&lt;/p&gt;&lt;p&gt;db.Tab1s.InsertOnSubmit( tab1 obj);&lt;/p&gt;&lt;p&gt;db.Save();&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;db.Tab2s.InsertOnSubmit(tab2 obj);&lt;/p&gt;
&lt;p&gt;db.Save();&lt;/p&gt;
&lt;p&gt;&amp;nbsp;But When I try to insert data to tab3 in simiar way:&lt;/p&gt;&lt;p&gt;db.Tab3s.InsertOnSubmit(tab3 obj);&lt;/p&gt;
&lt;p&gt;I got exception eroro said that tabl3 has no primiary key.&amp;nbsp; tab3 only have a index on cola, colb:&lt;/p&gt;&lt;p&gt;-&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;ex&amp;nbsp;&amp;nbsp; &amp;nbsp;{&amp;quot;Can&amp;#39;t perform Create, Update or Delete operations on &amp;#39;Table(Tab3)&amp;#39; because it has no primary key.&amp;quot;}&amp;nbsp;&amp;nbsp; &amp;nbsp;System.Exception {System.InvalidOperationException}&lt;/p&gt;&lt;p&gt;How to resolve this issue?&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>