Click here to Skip to main content
16,008,299 members
Home / Discussions / C#
   

C#

 
GeneralRe: Buttons on C# sharp app now cause System sounder to beep! Pin
glennPattonWork320-Jun-12 1:52
professionalglennPattonWork320-Jun-12 1:52 
AnswerRe: Buttons on C# sharp app now cause System sounder to beep! Pin
احمد مقبل الصراري20-Jun-12 9:18
احمد مقبل الصراري20-Jun-12 9:18 
GeneralRe: Buttons on C# sharp app now cause System sounder to beep! Pin
glennPattonWork320-Jun-12 21:49
professionalglennPattonWork320-Jun-12 21:49 
QuestionConvert PDF to Word using C# Pin
nvarunkumar19-Jun-12 22:52
nvarunkumar19-Jun-12 22:52 
AnswerRe: Convert PDF to Word using C# Pin
Hum Dum19-Jun-12 23:00
Hum Dum19-Jun-12 23:00 
AnswerRe: Convert PDF to Word using C# Pin
Pete O'Hanlon19-Jun-12 23:05
mvePete O'Hanlon19-Jun-12 23:05 
AnswerRe: Convert PDF to Word using C# Pin
Richard MacCutchan20-Jun-12 3:18
mveRichard MacCutchan20-Jun-12 3:18 
QuestionC# 2010 delete from database Pin
sc steinhayse19-Jun-12 17:09
sc steinhayse19-Jun-12 17:09 
I have the following code in a C# 2010 application that uses linq to sql when connecting to a sql server 2008 r2 database.
var attplan = from p in attDataContext.At_Pln
                             where p.At_id.Equals((int)Session["AttD"])
                             select p;

               attDataContext.At_Pln.DeleteOnSubmit(attplan.FirstOrDefault());

               var att = from c in attDataContext.At
                         where c.At_id.Equals((int)Session["AttD"])
                          select c;


               attDataContext.At.DeleteOnSubmit(att.First());
               attDataContext.SubmitChanges();
Dead | X|

My problem is the following line of code:
attDataContext.At_Pln.DeleteOnSubmit(attplan.FirstOrDefault());


The At_Plan table can contain 1 to 500 rows that are related to the At table.
I want to use some other statement besides FirstOrDefault() since this only deletes one row in the attplan table. However, the application will not let me try another commands without obtaining a compile error.
Thus can tell me what other linq statement that I can use that will let me delete all the records in the
attplan table?
AnswerRe: C# 2010 delete from database Pin
Pete O'Hanlon19-Jun-12 23:18
mvePete O'Hanlon19-Jun-12 23:18 
QuestionH.264 decode without stream Pin
Medvezhonok19-Jun-12 12:31
Medvezhonok19-Jun-12 12:31 
QuestionHow To Parse This String Pin
Kevin Marois19-Jun-12 9:53
professionalKevin Marois19-Jun-12 9:53 
AnswerRe: How To Parse This String Pin
PIEBALDconsult19-Jun-12 10:40
mvePIEBALDconsult19-Jun-12 10:40 
GeneralRe: How To Parse This String Pin
Kevin Marois19-Jun-12 10:42
professionalKevin Marois19-Jun-12 10:42 
GeneralRe: How To Parse This String Pin
Dave Kreskowiak19-Jun-12 11:08
mveDave Kreskowiak19-Jun-12 11:08 
GeneralRe: How To Parse This String Pin
Pete O'Hanlon19-Jun-12 11:20
mvePete O'Hanlon19-Jun-12 11:20 
GeneralRe: How To Parse This String Pin
Kevin Marois19-Jun-12 11:38
professionalKevin Marois19-Jun-12 11:38 
AnswerRe: How To Parse This String Pin
Paul Conrad19-Jun-12 12:20
professionalPaul Conrad19-Jun-12 12:20 
GeneralRe: How To Parse This String Pin
Pete O'Hanlon19-Jun-12 12:33
mvePete O'Hanlon19-Jun-12 12:33 
GeneralRe: How To Parse This String Pin
PIEBALDconsult19-Jun-12 12:48
mvePIEBALDconsult19-Jun-12 12:48 
GeneralRe: How To Parse This String Pin
Pete O'Hanlon19-Jun-12 22:28
mvePete O'Hanlon19-Jun-12 22:28 
GeneralRe: How To Parse This String Pin
PIEBALDconsult20-Jun-12 3:32
mvePIEBALDconsult20-Jun-12 3:32 
GeneralRe: How To Parse This String Pin
Pete O'Hanlon20-Jun-12 3:48
mvePete O'Hanlon20-Jun-12 3:48 
GeneralRe: How To Parse This String Pin
PIEBALDconsult19-Jun-12 12:36
mvePIEBALDconsult19-Jun-12 12:36 
GeneralRe: How To Parse This String Pin
Pete O'Hanlon19-Jun-12 12:39
mvePete O'Hanlon19-Jun-12 12:39 
GeneralRe: How To Parse This String Pin
Kevin Marois19-Jun-12 12:48
professionalKevin Marois19-Jun-12 12:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.