Linq select from datatable help

Hi, I have a datatable with your typical ID column and a notes
column.  I'm trying to get the notes for  a specific id passed to my
method.

Lanquage: C#
datatable is dtConfig
iID is passed into the method

Here is my (non-working :) ) linq code:

var sNotes = (from row in dtConfig.AsEnumerable()
where row.Field<int>("ID") == iID
select row.Field<String>("Notes"));

What am I doing wrong?

PS: I'd like to return a string rather then a var if possible, ie:
string sNotes = ....

Thanks.
G
0
GiJeet
4/28/2010 6:19:37 PM
dotnet.languages.csharp 1931 articles. 0 followers. Follow

1 Replies
1000 Views

Similar Articles

[PageSpeed] 13

Nevermind, I found the issue.  I needed to add FirstOrDefault()  to
the end.  Now it works ok.


0
GiJeet
4/28/2010 7:08:30 PM
Reply:

Similar Artilces:

Is there a way to attach a xslt template to a xsltargumentlist? please help!
in C#, I use the following way to do transform, the I assign my extension object to the xslArg, so in xsl, I can call functions in the extension object. Now, I want functions in the extension object to call template in the xsl, this way I can put some customized code into the template. I think it is reasonable, but I don;t know how to do it, anyone has some idea on this? Thanks. xslt.Transform(xmlDoc, xslArg, textHTML, null); david wrote: > in C#, I use the following way to do transform, the I assign my extension > object to the xslArg, so in xsl, I can call functions in the extens...

MS Publisher "Select Table" won't list views with user-defined functions?!
MS Publisher "Select Table" won't list views (queries) containing user-defined functions?! What's wrong? And how to work around this? Using the latest version of Microsoft Publisher and MS Access (2003 sp2 with all latest updates), I am trying to create physical asset labels, with a unique serial number on each label. And in Microsoft Publisher, when I go to "select data source" and select my MS Access database "20060117pst2301pmb primary.mdb" (which generates such serial numbers), I get a popup entitled "Select Table" which lists all its tab...

Microsoft Excel Help
Why are they called arguments when creating an Excel function? i need to no for a Excel test! what makes them arguments? Hi if you mean the 'parameteres' of a function how would you call them otherwise :-) -- Regards Frank Kabel Frankfurt, Germany "martz" <anonymous@discussions.microsoft.com> schrieb im Newsbeitrag news:0b2601c4d8e5$c05f7bd0$a301280a@phx.gbl... > Why are they called arguments when creating an Excel > function? i need to no for a Excel test! what makes them > arguments? ...

Need help grouping charts
I have identical charts which occur on multiple sheets. Is there any wa to group them for editing? When I group the sheets themselves, it seems to deactivate the charts I tried doing it with a macro as an alternative and then flipping th sheets one by one and keying the macro, but I get a message box with: "Run-time error 1004", "Unable to get the ChartObjects property of th worksheet class". Does anyone have any ideas -- Izz ----------------------------------------------------------------------- Izzy's Profile: http://www.excelforum.com/member.php?action=getin...

Help with Now()
Hi, I am creating a spreadsheet and I need to have a cell and that record the date and time each row is entered seperately. The problem I have at the moment is whenever I add a new row of data i updates the previous rows time? does any one have any suggestions on how to stop this happening? thank -- sydoll ----------------------------------------------------------------------- sydolly's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=2712 View this thread: http://www.excelforum.com/showthread.php?threadid=46697 Now() is a volatile function and will change ev...

DB Mail is is not working. Need help please.
I have try stop and start the db mail by executing the SPs below but no luck. Does anyone has seem the error below and how to fix it. Thanks in advance for your advise/help. --steps USE msdb; go EXECute sysmail_stop_sp; go EXECute sysmail_start_sp; go EXECute sysmail_help_queue_sp @queue_type = 'Mail'; go queue_type length state last_empty_rowset_time last_activated_time ---------- ----------- ---------------------------------------------------------------- ----------------------- ------------...

Help with Raw Stock Data Collection
Is it possible to have Excel search through 1 minute raw data and be able to determine if the price moves between a certain boundary for a certain time then it will be classified as "Type 1". And if it is increasing for a certain time then it will be "Type 2" and likewise for when it is decreasing. I want Excel to be able to automatically search through the raw data and determine what is the type of state without myself having to manually pinpoint it on the chart then going back and doing a manual search and calculation in Excel. Only issue is that the exact number determi...

Third request for help with Payables Error message!
Ok I have posted this for the third time with no response! I need help to know if there is any kind of issue on the back end of our environment. If someone could help it would be greatly appreciated! We are currently running GP 10 SP1 and apparently since version 8 (we did not upgrade to 9) there has been the following error message while launching a transaction out of Smartlist, when we go to inquiry for AP documents, and drill down of PMTRX & PMCHK from the JE inquiry view: Unhandeled Script Exception: Index 0 array of 'PM_Transaction_Inquiry_Fill' Script terminated We ran a ...

HELP
I just wrote a check to the IRS, and in the Expense Catagory I indicated "Taxes : Federal Income Tax". Yet in the Income/Expense report, this payment is not included in my total federal taxes paid for this month. I should note that the check was written from an Investment Account. If I write the check from my checking account, the amount correctly shows up in the Income/Expense report. Any ideas as to why it works differently, depending on which account I pay the tax from? In microsoft.public.money, Tom wrote: >I just wrote a check to the IRS, and in the Expense Cat...

Change Backcolor for the selected line
I would like to be able to highlight or change the color of a single line on a subform formated as a continuous form. The user selects one line from many possible lines on a continuous form to respond to. When he selects the line another pop-up form is display which the user must complete. I would like to maintain some kind of highlight (backcolor?) so that the user can clearly see which line he is reponding to. Setting the backcolor after selecting a line sets the back color for the entire form, which really defeats the purpose. Any help? -- Message posted via AccessMons...

Calendar/Dates Help
Hi All, I have an excel spreadsheet that lists every date in the year, with a particular code in the next cell. IE: Monday 3/01/2005 11M 22M 32M Tuesday 4/01/2005 11T 22T 32T Wednes 5/01/2005 11W 22W 32W Thursday 6/01/2005 11H 22H 32H Friday 7/01/2005 11F 22F 32F Saturday 8/01/2005 11S 22S 32S Sunday 9/01/2005 11N 22N 32N Monday 10/01/2005 11M 21M 33M Tuesday 11/01/2005 11T 21T 33T Wednes 12/01/2005 11W 21W 33W Thursday 13/01/2005 11H 21H 33H Friday 14/01/2005 11F 21F 33F What I need is to be able to search by the code eg "33T" and have all the dates listed for ...

Urgent help with CStringArray
Hello, i need to return a CStringArray from a class method, but CStringArray (and CStringList also) doesn't have a copy constructor! I want avoid memory allocation within the metod because I don't want to force the class user to deallocate pointers... this is the piece of code: const CStringArray MyClass::MyMethod() { CStringArray StrArray; for (...) StrArray.Add("something"); return StrArray; // this will generate a missing copy constructor compile error } Thank you, Gaetano Sferra "Gaetano Sferra" <rebusmail@iol.it> wrote in messag...

vlookup help #3
hello, I cant figure out the proper syntax for the attached workbook. Th first 8 options on worksheet two work perfectly ( ie when checked, the appear on worksheet 3) I dont know how to apply the formula of th first 8 options to the rest of the checkboxes. Can someone please help me figure out how to do this? Thanks i advance. Aladdi Attachment filename: start order2.zip Download attachment: http://www.excelforum.com/attachment.php?postid=46674 -- Message posted from http://www.ExcelForum.com Right-click on the sheet tab for the Options worksheet. Select View ...

Bill Pay Help
I just signed up for Bill Pay (I have Money 2005), I'm not sure how to coordinate Bill Pay with my Bills list and my checking account register. It makes a separate Bill Pay register, but won't allow me to merge it with my checking account (as Help suggests). Tech support was completely useless, in fact it seems they're in a hurry to get us off the phone. ...

Just Help Me
Hello All . . . Please answer the questionary in the following URI http://nees.awardspace.com/ Thanks a lot . . . :D Post the question here, and we might. -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "CorfuVBProgrammer" <merianosnikos@gmail.com> wrote in message news:1167902152.017496.205590@11g2000cwr.googlegroups.com... > Hello All . . . > > Please answer the questionary in the following URI > > http://nees.awardspace.com/ > > Thanks a lot . . . :D > ...

Help revising slow code
I am using the following code to remove all the lines in a worksheet that have a zero value in Column H. Because there are thousands of rows in the worksheet, this loop takes forever! Does anyone have any suggestions for doing this more quickly? Thanks! Sub Delete_Row_w0() Dim Firstrow As Long Dim LastRow As Long Dim Lrow As Long Dim CalcMode As Long Dim ViewMode As Long With Application CalcMode = .Calculation .Calculation = xlCalculationManual .ScreenUpdating = False End With With Sheets(1) .Select ...

Need Help
Query: Say i have multiple sheets dated 04/01/10 to 04/30/10, each contain names, say A, B, C, D, etc... but these name does not appear in the same order in each sheet. Now data is in time format in front of A, B, C, D, etc. Eg. in sheet 04/01/10 A1 B1 A 1:00:00 D 1:53:00 C 2:45:00 like this data in other sheet till 04/30/10. Now in a new sheet i want this data to be collated in time format in front of the individual sorted in Alphabetical order. Also it should give me the Sum of the data. Is it possible and how? Thanks in advance for the help!...

corrupted PST file
Hi, I have Outlook 98, running on XP, on a PII 400Mghz Dell desktop. My PST file is about 1.95GB. It has been running extremely slow, and has had to be restarted a bunch of times in the past 2 weeks. Yesterday, it gave an error that the PST file was corrupted, and that PST file need to have the Inbox Repair Tool run on the file, and then the system restarted. I ran the Inbox Repair Tool on the PST, and it did not work. I am totally unable to use the file, which has all my critical contacts and emails. If someone could help out, I would be MOST grateful.... I pulling my friggin ...

Autofilter help
Hi all I have 4 columns of data with an auto filter on - all ok I then reduce my selection so I finally only have one row of data - all ok Not ok: Problem: Is there an easy way that I can copy the data in the top row of the filter, to another worksheet page - so if the filter is changed so top line shows new result - still copies over the data in the top row of the filter. Bearing in mind that the top row could be I.E. Originally Row 8 or 108 depending on the selection. Autofilter Line = 1 2 3 4 eg Result of A/F a a a a <== copy the result of this line to dif...

Help need for .net assembly in Workflow manager
A simple code (given below) creates a task thro' .net assembly . I invoked this code via console application & found that it is running fine. It is creating task in CRM successfully. The problem is : when I included it in Work flow manager, it displays that "task completed" in workflow monitor but it is not creating a task in CRM . using System; using System.IO; using TaskCreation.CRMWeb; namespace TaskCreation { /// <summary> /// Summary description for Class1. /// </summary> public class Class1 { public Class1() { // // TODO: Add construc...

Multi-Select Listbox VBA code causing overflow in loop
Private Sub Form_Current() Dim oItem1 As Variant Dim oItem2 As Variant Dim bFound1 As Boolean Dim bFound2 As Boolean Dim sTemp1 As String Dim sTemp2 As String Dim sValue1 As String Dim sValue2 As String Dim sChar1 As String Dim sChar2 As String Dim iCount1 As Integer Dim iCount2 As Integer Dim iListItemsCount1 As Integer Dim iListItemsCount2 As Integer sTemp1 = Nz(Me!SignsList.Value, " ") sTemp2 = Nz(Me!SymptomsList.Value, " ") iListItemsCount1 = 0 iListItemsCount2 = 0 bFound1 = False bFound2 ...

Help Locking Worksheet
I inherited a workbook that has several sheets, have gone thru and mad changes and now when I lock it I cannot go from the last table cell o the first row to the second row. Tabbing will just continue you out o the same row. I want to be on cell BD3, hit tab and go to C5. Does the fact that I have the to & leftmost cells frozen have anythin to do with this? How can I fix it -- jlabshe ----------------------------------------------------------------------- jlabsher's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1556 View this thread: http://www.excelfo...

Help: Seting the value of another cell with a formula
I know that there's a way to make a cell a particular value based on the entries of a range, or array of cells, but is it possible to do the reverse, using only one formula in a cell. Here's what I'm trying to do: What I would like to do is set one of a range of cell to have a value based on the value in A2. Example: Cell A1 has a value of 2, A2 has a value of 2007. I want A10 to equal A1, i.e.:2 Cell A1 has a value of 2, A2 has a value of 2008. I want A11 to equal A1, i.e.:2 Cell A1 has a value of 2, A2 has a value of 2009. I want A12 to equal...

Select more than 1 object in the lookup field
I would like to have the ability to select more than one object in a lookup field. Is there a way to accomplish this? Thanks No. The only exception to this is the party list (like the to, cc and bcc fields in an email), but this is an internal thing and cannot be used in customizations. -- Michael H�hne, Microsoft Dynamics CRM MVP Web: http://www.stunnware.com/crm2 Feed: http://www.stunnware.com/crm2/atom.aspx Custom Lookup Dialog: http://www.stunnware.com/crm2/?area=customLookup ---------------------------------------------------------- "Onetreeup" <Onetreeup@discussions...

How Many Days Since... Formula -Help
Hi, can anyone help? I have a spreadsheet tracking several different Departments in our company and how often they have an accident. I need to track how many days they go without an accident. So if Dept A had their latest accident yesterday. And if someone opens the spreadsheet in 3 days, it should say "4 days w/o an accident for Dept A. I'm sure this can be done, I just have no idea how :roll: Thanks in advance, Scotty Assuming 8/5/2003 is the start date... =TODAY()-"8/8/2003"&" Days w/o an accident for Dept A" Lance >-----Original Message----- &...