submitchanges

“A cycle was detected in the set of changes” with Linq to SQL

和自甴很熟 提交于 2019-12-11 09:12:53
问题 I am currently developing an application in which i experience the exception "A cycle was detected in the set of changes" when calling DataContext.SubmitChanges(). I know why this exception is thrown but i have not been able to find a fix for my situation. Let me explain the situation. I have a database with a table as shown below which i access with LINQ to SQL so it gets mapped to classes in vb.net. Device ------- ID DefaultGatewayID The DefaultGatewayID is a Device an can even be the same

LINQ problems with NText, Text and Image on SQL server

本秂侑毒 提交于 2019-12-06 22:02:36
问题 Apologies up front, because this isn't a question but a solution - but it took a lot of searching to find out the answer and google wasn't much help, so I wanted to give something back to the community by providing the error and the solution to help future googlers. When using LINQ to SQL, I ran into a problem when submitting changes (the second time) to a data table. The first time I submit changes all is OK, the second time I submit changes I recieved a SQL exception which said: "The text,

LINQ problems with NText, Text and Image on SQL server

邮差的信 提交于 2019-12-05 02:09:13
Apologies up front, because this isn't a question but a solution - but it took a lot of searching to find out the answer and google wasn't much help, so I wanted to give something back to the community by providing the error and the solution to help future googlers. When using LINQ to SQL, I ran into a problem when submitting changes (the second time) to a data table. The first time I submit changes all is OK, the second time I submit changes I recieved a SQL exception which said: "The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator"

Row not found or changed LINQ C# error on simple statement

时光毁灭记忆、已成空白 提交于 2019-12-03 05:49:07
问题 First of all, there is no chance that this is a multi-user issue, as I'm working locally on a dev version of the database. I am getting the not very explanatory Row not found or changed error being thrown when I perform db.SubmitChanges(). If I break the execution just before the SubmitChanges() occurs, I can check in SQL Server Management Studio and the row does exist! Here's the code for the whole function, just to put it in context for anyone who wants to help, but the problem line is

LINQ to SQL SubmitChangess() progress

柔情痞子 提交于 2019-12-01 19:51:34
I'm using LINQ to SQLto import old DBF files into MSSQL. I'm reading all rows and adding them to database using ctx.MyTable.InsertOnSubmit(row) After reading phase is completed I have around 100 000 pending inserts. ctx.SubmitChanges() naturally is taking a long time. Is there any way to track progress of the ctx.submitchanges() ? Can ctx.Log somehow be used for this purpose? Update : Is it possible to use ctx.GetChangeSet().Inserts.Count and track insert statements using the Log? Dividing ctx.SubmitChanges() into smaller chunks is not working for me, because I need transaction, all or nothing

Exceptions by DataContext

蹲街弑〆低调 提交于 2019-11-30 06:54:12
I've been doing some searching on the internet, but I can't seem to find the awnser. What exceptions can a DataContext throw? Or to be more specific, what exceptions does the DataContext.SubmitChanges() method throw? EDIT For reference, here a List of possible known exceptions that could be thrown by the L2S DataContext: SqlException ChangeConflictException DuplicateKeyException ForeignKeyReferenceAlreadyHasValueException OutOfMemoryException (when not correctly disposing the DataContext) You're right, MSDN is not a great help here. This is what I can remember from the top of my head:

ASP.NET Form - The form name\id changes to aspnetForm

孤街醉人 提交于 2019-11-28 00:44:51
问题 I have this code: <form Name="AddPlace" ID="AddPlace" action="AddPlace.aspx" class="niceform" method="post" runat="server"> That when i try to execute the code i get this instead: <form name="aspnetForm" method="post" action="AddPlace.aspx" id="aspnetForm" class="niceform"> How come it changes? 回答1: ASP.NET web forms takes control over the form element; for instance, if you try to change the action, ASP.NET will ignore it and change it back... why do you need a specific ID? Why won't

LINQ not updating on .SubmitChanges()

余生颓废 提交于 2019-11-27 02:03:39
Is there any reason something like this would not work? This is the logic I have used many times to update a record in a table with LINQ: DataClasses1DataContext db = new DataClasses1DataContext(); User updateUser = db.Users.Single(e => e.user == user); updateUser.InUse = !updateUser.InUse; db.Log = new System.IO.StreamWriter(@"c:\temp\linq.log") { AutoFlush = true }; db.SubmitChanges(); (updateUser.InUse is a bit field) For some reason it isn't working. When I check the linq.log it is completely blank. Could there be a problem with my .dbml? Other tables seem to work fine but I've compared

LINQ not updating on .SubmitChanges()

吃可爱长大的小学妹 提交于 2019-11-26 09:54:29
问题 Is there any reason something like this would not work? This is the logic I have used many times to update a record in a table with LINQ: DataClasses1DataContext db = new DataClasses1DataContext(); User updateUser = db.Users.Single(e => e.user == user); updateUser.InUse = !updateUser.InUse; db.Log = new System.IO.StreamWriter(@\"c:\\temp\\linq.log\") { AutoFlush = true }; db.SubmitChanges(); (updateUser.InUse is a bit field) For some reason it isn\'t working. When I check the linq.log it is