ADO.NET :: Linq To SQL Transactions With Multiple Deletes?

Sep 29, 2010

I am trying to delete three related objects on one submit. Delete fails on one of the child objects, because of foreign key contraint with another table, It deletes one (the parent) but not the two child objects. All in one SubmitChanges(). I even used the TransactionScope, still same thing. So here is the scenario:

I have an object called Page which has a collection of objects called Webinars. There is another object Called Product which is one to one with Webinar.

[Code]....

View 5 Replies


Similar Messages:

ADO.NET :: Does Linq Dbml Need Refreshed After Allowing Cascade Deletes On Tables

Oct 20, 2010

When setting up my database, I forgot to set the delete rule to cascade on foreign keys. Now, I can't delete a user from the ASP.net control panel due to the FK constraints. So, I need to go through all my tables and allow cascade delete on all keys.Once I do this, will I need to redo my Linq .dbml? (ie: delete each table on it and drag it back on) or does it not matter?

View 5 Replies

Are There Any Transactions Around Multiple Webservice Calls

Mar 31, 2011

Are there any transactions around multiple webservice calls.Let me start with a commonly used example -- the travel agency. A customer intends to create a travel plan through an online travel agency. To do this, the online travel application calls the following three Web services:

-Air ticket booking
-Hotel reservation
-Taxi reservation

These three services are available from three separate vendors. If any one of these three services fails, the customer does not wish to proceed with the transaction (again, either all three services must succeed or none at all).My language programming is Asp.net c#.

View 1 Replies

Transactions Around Multiple Webservice Calls?

Apr 4, 2011

Are there any transactions around multiple webservice calls?but in ASP.net forum I got the answer below:

http://jalpesh.blogspot.com/2010/05/using-transactions-with-linq-to-sql.html it's offering system.transaction.

View 2 Replies

Databases :: Multiple Transactions In One Method?

Nov 10, 2010

I have an application which connect to oracle db.

I have two database hitting functions.

One is adding Userdetails(Fn Name : AddUserDtls) and another one adding address details(Fn name : AddAddresDtls) based on UserName which will get added after execution of first method ie AddUserDtls.

Problem I am facing is :

I have a single transaction and in that I have all the methods.

After the execution of first method,with out commiting i will go to second method.

and if any error occurs in second method.

I will rollback everything including the changes made by first method also.

Here one issue is there.

Since I am not committing the changes made by first method,

While I am executing the second method I am getting error that 'No user Name exists'

I understood that if we commit the transaction before the second method starts ,it will solve the issue.

But then it creates another problem.If some problem araise in the second method,then I cannot rollback the changes made by first method since it aleready commited.

View 1 Replies

MVC :: Pattern For EF 4.0 CRUD / Transactions When Updating Multiple Objects?

Nov 17, 2010

I am looking for an accepted pattern for using MVC 2 and EF. Especially I am interested on how to implement updates. Where should the ObjectContext be created, where should the queries be, how to pass a model object from the controller and have it persisted with minimum robust code. I also want to be able to use transactions when updating multiple objects.

I used Linq in an asp.net application (code behind model). With EF I was hearing it was much more n-tier friendly, but I don't find it any different, rather than people talking about POCO which to me, all it means is satisfying the desire of those that want to have control of every piece of code being created.

View 6 Replies

DataSource Controls :: Wrapping Multiple TableAdapters Inside Transactions?

Jan 9, 2010

In my project's earlier version I used Stored Procedures (SPs) & directly used them inside presentation layer. SP contains multiple Insert & Update queries for multiple tables.

Now I have decided to use a DAL(Typed DataSets & TableAdapters)

How can i use the same SPs with TableAdapters or If not possible how to wrap Multiple TableAdapters inside Transactions.

1 more thing in my earlier version i was using Transaction in SPs & Presentation Layer.

View 5 Replies

C# - LINQ To Entity Framwework Multiple Joins With Multiple Dynamic Search Criteria?

Jul 2, 2010

The gist of the problem is that we have an alumni table (one record per person) and also a couple of other tables (one to many) that have degree info and interest info. In a search screen in our app you can search for criteria that spans all three tables (there are actually more fields and tables than shown in the example below but I am trying to keep it simple).

The code below works (properly returns people without degrees for example) but still feels a little clunky or over-engineered to me. Are there easier ways to do this? NOTE: I have been through quite a few iterations/approaches to making the correct data be returned.

[code]....

View 1 Replies

ADO.NET :: LINQ To SQL - Multiple Joins With Multiple Conditions?

Jan 28, 2011

I have some problems trying to query my database. The problem is that I'm not sure how to multiple join tables in my database.

tables to make it easier:

[code]....

What I'm supposed to do is to find all the teachers (predavac) who were teachers on the specific activity (aktivnost) and who had specific attendee (polaznik). The problem is I'm not sure how to do multiple joins on this one.

View 1 Replies

IIS Deletes System.Web.Extensions.dll?

Aug 26, 2010

I moved a site to another server, it worked fine for a a while, but then crashed. I figured out that System.Web.Extensions.dll was missing, so I copied it again. After a while it was missing again. Using Process Monitor I figured out that IIS (w3wp.exe) deletes the file soon after I copy it to the bin folder. (CreateFile with "Read Attributes, Delete" access.)

View 1 Replies

Access :: Database Deletes Records When Connect?

Oct 6, 2010

I have a problem regarding database. I write to the database fine with this code:

[Code]....

When I close the application and view the Database with access.. the records are added ok, but when I start the application the records are deleted. This is what I have in the Form_Load:

[Code]....

View 1 Replies

Web Forms :: Create One Subroutine To Handle All Deletes For Page?

Mar 5, 2011

I am trying to create one subroutine that can handle all deletes for a web app. I have one delete popup panel in my master page, and I call it each time from my content pages. When an instance of delete is called from a content page, I store the name of a delete subroutine specific to the delete instance in a session variable and popup the delete panel in the master page. If a user types YES into a delete textbox in delete popup panel, a confirmDelete Subroutine in codebehind of the Masterpage is called. When the confirmDelete subroutine in the Masterpage is callled, I want to call a subroutine in the content page that has the name stored in the session variable. What is the simplest way to do that?

View 1 Replies

MVC :: NerdDinner Sample - How Does Delete Work - How To Control Deletes

Jun 7, 2010

I am still at the elementary stages of Linq To Sql and Entities usage. I started practicing MVC developement by following the NerdDinner tutorial here at asp.net, and I back myself up with fully developed NerdDinner sample (1.0 -- still on VS2008). I am also at the first half of the NerdDinner tutorial (I think -- maybe I'm further along) - so far I have gotten up to the Delete View. In the fully developed sample I noted that it uses ascx file (which I guess I will find out if the tutorial also will use
ascx files down the road). My sample app, which I am developing from the tutorial, seems to work OK so far. My issue is that I am not clear how the Delete mechanism works. In the DinnerRepository.cs I have this code (from the tutorial):

[code]....

It looks like a dinner object is being passed to these mechanisms and the delete occurs based on a row ID value. But what if I wanted to delete multiple rows - say where ID between 15 and 20 - how to go about this? I was looking for a Delete statement but am not finding it either in what I have developed so far from my tutorial sample or from the fully developed sample. How can I control Deletes in MVC?

View 1 Replies

.net - NHibernate 'Where' Clause Causing Problems On Cascading Deletes?

Jan 21, 2011

I have the following mapping file for 'Photo' objects (edited for brevity):

<hibernate-mapping ... default-access="property" default-cascade="none" default-lazy="true">
<class xmlns="urn:nhibernate-mapping-2.2" name="Photo" table="Photos">
<id name="PhotoId" unsaved-value="0"> [code]...

How can I get around this?

View 1 Replies

C# - Javascript Confirm Before Running The Eventhandler, Which Deletes Records From The Databse

Apr 14, 2010

I have button, which fires an event, that deletes a record from the database. This is the source of the button:

<asp:Button ID="btnDelete" runat="server" Text="Delete" onclick="btnDelete_Click" />

But how can I make a confirm box appear before the deletion?

View 1 Replies

DataSource Controls :: Logging Inserts, Updates And Deletes On A Table?

May 27, 2010

Does SQL Server 2008 have a built in way to log all inserts, updates and deletes on a table?The updates, inserts, deletes would come from an asp.net 3.5 webpage using SQLDataSources.If so how would I attach the UserID of the website to the database changes logs?

View 4 Replies

Forms Data Controls :: Page Deletes Records In Database When Refreshed?

Mar 10, 2010

I have created a page with a gridview in asp.net that displays the records of a database table and allows users to delete checked records by clicking on a delete button. After I delete a record and I try to refresh the page from the browser (I am using mozilla)I get the follow message:

"To display this page, Firefox must send information that will repeat any action (such as a search or order confirmation) that was performed earlier."

and if I click resend another record is deleted automatically. Even though I am reloading the gridview after the deletion the application executes again the onclick event of the delete button is executed and the gridview things that there is a checkedbox selected so the code executes my delete function again.

Is there any way to get rid of these behavior. I have been trying quit a few things but nothing works for me.

View 2 Replies

Forms Data Controls :: GridView Delete Link Deletes Previous Row?

Jul 28, 2010

The delete link on my gridview deletes the previous row instead of selected row....Also, it doesnot delete the already existing rows. When I add new rows and try to delete them then my delete works that too incorrectly.

View 5 Replies

ADO.NET :: Linq Multiple Where From Second Table

Dec 16, 2010

Tables:

WORKORDER and CUSTFIELD

Fields:

WORKORDER = WORKORDERID

CUSTFIELD = WORKORDERID, CUSTFIELDNAME, CUSTFIELDVALUE

There are multiple different type of name/value pairs. I want to specifically return the custfield value where custfield name is "INCIDENT", and the custfield value where custfield name is "NETWORK" all for the appropriate WORKORDERID

I've tried a few different ways and just can't grasp how the linq is supposed to go to get the results I want. I can get an incident value, or network value, but not both.

I have the proper association set up in the dbml so both of these work to get the single value:

var b = from i in edcwdv.WOCUSTFIELDs join p in edcwdv.WORKORDERs on i.WORKORDERID equalsp.WORKORDERID where i.CUSTFIELDNAME.Contains("INCIDENT") select new { i.CUSTFIELDNAME, i.CUSTFIELDVALUE, p.WORKORDERID };
var incident = from wo in edcwdv.WORKORDERs orderby wo.WORKORDERID where wo.WOCUSTFIELDs.CUSTFIELDNAME.Contains("INCIDENT") select new { wo.WORKORDERID, wo.WOCUSTFIELDs.CUSTFIELDVALUE}; So essentially i want to pull the value for each of the fields, INCIDENT and NETWORK

View 2 Replies

C# - Send Multiple Emails (via LINQ To SQL)?

Jun 13, 2010

The objective is to send automated emails to which of whom come from the results of my LINQ to SQL script. As I am not sure on 'automated' stuff I was going to approach this in the aspect of having a field in the table that the results are taken from change after the emails have been sent i.e. obj.EmailSent = true; - So that everytime the admin homepage is loaded it isnt sending it out again (eliminating duplication).

From that I would have to create a method to detect a new year and upon that reset all entries of the EmailSent field in the DB table to 'false', but for now its just the initial problem thats causing confusion.

I was going to opt for a 'foreach' solution so that all the recipients, individually, get their emails and not all together. Its the 'foreach' I'm not sure on as well as setting all the results collected to the new value of 'EmailSent' to 'true'.

Here is my attempt:

C#:

[code]....

View 9 Replies

ADO.NET :: Linq On Multiple Tables With Same Columns

Aug 17, 2010

I have a partitioned db where several tables have the exact same structure. I'm able to query the tables using linq, but only by quering the individual tables 1 at a time and by using the explicit table name. For example at the moment, I have 8 tables so I have something similar to the following:

[Code]....

Is there any way, that based on a certain value (stringValue), I could determine which table to query and then code the linq query just once?

View 2 Replies

ADO.NET :: Searching Through Multiple Tables (Linq To SQL)?

Aug 12, 2010

I have a couple tables that are kind of unrelated - id like to search through both of them and create a type that i can sift through later

something like this doesnt work

[Code]....

I basically want to create a list of "AnimalSearchResults" that contains all dogs and all cats that have that name Whats the best way to do something like this?

View 6 Replies

C# - Linq To Sql Making Multiple Calls In .net Mvc 3

Mar 18, 2011

When I am updating a record with linq to sql my DeleteLesson() method is getting called multiple times.My controller looks like this :

public ActionResult Delete(int id)
{

deleteLesson(id);[code]....

EDIT.also if I use confirm = "Do you want to delete" in ajax options I will have to click okay three times.

View 1 Replies

IQueryable Linq To SQL With Multiple Operators

Jul 4, 2010

I'm creating a repository and service layer in my app, and my repo has a very simple function

Public Function GetRegions() As IQueryable(Of Region) Implements IRegionRepository.GetRegions
Dim region = (From r In dc.Regions
Select r)
Return region.AsQueryable
End Function

Now in my Service layer I've got a function like this

Public Function GetRegionById(ByVal id As Integer) As Region Implements IRegionService.GetRegionById
Return _RegionRepository.GetRegions().Where(Function(r) r.ID = id).FirstOrDefault
End Function

But i can't figure out how to add And r.isActive = True

how to have multiple operators in this query?

View 3 Replies

C# - Linq - Group By Multiple Tables?

Aug 8, 2010

Using Linq to Sql how do i group the following 2 tables.

Orders Table:

CustomerID | Name |Date
1 | order1 | 2010-01-01
2 | order2 | 2010-01-01
2 | order3 | 2010-04-01

Calls Table:

CustomerID | Name |Date
1 | call1 | 2010-01-01
3 | call2 | 2010-06-01
2 | call3 | 2010-05-01

I want to group the two tables by date , Result:

Date | Orders | Calls
2010-01-01 | 2 | 1
2010-04-01 | 1 | 0
2010-05-01 | 0 | 1
2010-06-01 | 0 | 1

i know how to group a single table ,from o in Orders group o by o.Date.Date into og select new {Date = og.Key,Orders= og.Count()};

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved