Click here to Skip to main content
15,891,204 members
Home / Discussions / C#
   

C#

 
AnswerRe: What this mean ??. This code works fine. [Edited to show message which OP deleted] Pin
Pete O'Hanlon13-Nov-11 9:44
mvePete O'Hanlon13-Nov-11 9:44 
GeneralRe: What this mean ??. This code works fine Pin
AnnieMacD13-Nov-11 9:49
AnnieMacD13-Nov-11 9:49 
GeneralRe: What this mean ??. This code works fine Pin
Pete O'Hanlon13-Nov-11 10:03
mvePete O'Hanlon13-Nov-11 10:03 
GeneralRe: What this mean ??. This code works fine Pin
AghaKhan13-Nov-11 16:00
AghaKhan13-Nov-11 16:00 
RantRe: What this mean ??. This code works fine Pin
Smithers-Jones13-Nov-11 22:54
Smithers-Jones13-Nov-11 22:54 
GeneralRe: What this mean ??. This code works fine Pin
Pete O'Hanlon14-Nov-11 0:12
mvePete O'Hanlon14-Nov-11 0:12 
QuestionC# beginer a deploy Q using report viwer Pin
pinifg13-Nov-11 2:56
pinifg13-Nov-11 2:56 
Questionis this good C# linq to sql code? Pin
Member 821751712-Nov-11 14:17
Member 821751712-Nov-11 14:17 
I would like to know if the following code is written ok or is there a better way? If there is a better way, can you explain and/or point me to a reference I can use? Is the linq writing from one datacontext object to some data fields ok? Also is the try catch adequate?

I do know the code works since I stepped through the code.

I am asking the question is this is my first time working with linq to sql in a C# 2010 application and I am the only programmer at my company.

<pre> protected void Ready_Data(Attes att, AtsDataContext attDataContext)
{

try {

var results = from s in attDataContext.Attes_Schedules
where s.Pay_Month == att.Pay_Month_Date
select new
{
PayDate = s.Pay_Month,
CurCStopDate = s.Current_C_Stop_Date,
PriorCStopDate = s.Prior_C_Stop_Date,
RptsReceviedMonth = s.Rpts_Rec_Month,

};

foreach (var r in results)
{
att.Pay_Month_Date = r.PayDate;
att.Current_C_Stop_Date = r.CurCStopDate;
att.Prior_C_Stop_Date = r.PriorCStopDate;
att.C_Rpts_Rec_Date = r.RptsReceviedMonth;
}

}
catch (Exception ex)
{
lblErrorMsg.Text = "Attes Page Processing problem";
lblErrorMsg.Visible = true;
hold_Exception = ex;

}

}</pre>
AnswerRe: is this good C# linq to sql code? Pin
Not Active12-Nov-11 16:32
mentorNot Active12-Nov-11 16:32 
GeneralRe: is this good C# linq to sql code? Pin
Member 821751713-Nov-11 13:17
Member 821751713-Nov-11 13:17 
GeneralRe: is this good C# linq to sql code? Pin
Not Active13-Nov-11 13:52
mentorNot Active13-Nov-11 13:52 
AnswerRe: is this good C# linq to sql code? Pin
SledgeHammer0113-Nov-11 7:17
SledgeHammer0113-Nov-11 7:17 
GeneralRe: is this good C# linq to sql code? Pin
Richard Andrew x6413-Nov-11 7:58
professionalRichard Andrew x6413-Nov-11 7:58 
GeneralRe: is this good C# linq to sql code? Pin
Not Active13-Nov-11 13:49
mentorNot Active13-Nov-11 13:49 
GeneralRe: is this good C# linq to sql code? Pin
SledgeHammer0113-Nov-11 13:59
SledgeHammer0113-Nov-11 13:59 
GeneralRe: is this good C# linq to sql code? Pin
Not Active13-Nov-11 14:05
mentorNot Active13-Nov-11 14:05 
GeneralRe: is this good C# linq to sql code? Pin
SledgeHammer0113-Nov-11 14:27
SledgeHammer0113-Nov-11 14:27 
GeneralRe: is this good C# linq to sql code? Pin
BobJanova13-Nov-11 22:30
BobJanova13-Nov-11 22:30 
AnswerRe: is this good C# linq to sql code? Pin
omidh200713-Nov-11 11:58
omidh200713-Nov-11 11:58 
QuestionWinForms - Zoom In/Out (MS Word-Style) Pin
Matt U.12-Nov-11 6:46
Matt U.12-Nov-11 6:46 
AnswerRe: WinForms - Zoom In/Out (MS Word-Style) Pin
Alisaunder13-Nov-11 2:30
Alisaunder13-Nov-11 2:30 
GeneralRe: WinForms - Zoom In/Out (MS Word-Style) Pin
loyal ginger13-Nov-11 2:39
loyal ginger13-Nov-11 2:39 
GeneralRe: WinForms - Zoom In/Out (MS Word-Style) Pin
Alisaunder13-Nov-11 2:41
Alisaunder13-Nov-11 2:41 
AnswerRe: WinForms - Zoom In/Out (MS Word-Style) Pin
BillWoodruff13-Nov-11 11:00
professionalBillWoodruff13-Nov-11 11:00 
QuestionText Entry / Scrolling Dilema Pin
PDTUM12-Nov-11 6:41
PDTUM12-Nov-11 6:41 

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.