Need help getting started with LINQ

I'm using a project that had already been converted to framework 3.5.  I'm developing with VS 2008 Professional.  I have a very simple page to write.  It has a text box that updates one field in a small table.  Hardly more complicated than "Hello World" and I thought a good place to start using LINQ.

I've been going through the ASP.NET videos on LINQ, and created autoresponders.dbml for the autoresponders table.  The table contains three fields: ResponseID (identity & primary key), Responder (name of responder) and Text (responder text)  Now I have the following code:

Dim db As New AutoRespondersDataContext
Dim al = From a In db.AutoResponders Where a.Responder = "System" Select a
al.text = txtAlert.Text

That dratted blue squiggly line is appearing under al.text and the intellisense says "Text is not a member of System.LINQ.IQueryable (of AutoResponder)

What am I doing wrong?


11/25/2008 4:27:52 PM 93655 articles. 5 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 14

You need to use the Single property on your query:

Dim al = (From a In db.AutoResponders Where a.Responder = "System" Select a).Single

This will return a single record which does not need to be looped through.  Your original query returns a collection (even though it just has 1 item in it, its still a collection) which you would need to loop through.

"Sector clear"
11/25/2008 8:20:57 PM

That explains it, thank you!


11/26/2008 5:17:03 AM

Similar Artilces:

Help getting started with a dynamic web form
I'm new to .NET so I was hoping someone could point me in the right direction. I have a form that needs to be dynamically created based on the contents of a XML file. The XML contains data for each 'row' to be created and what type of fields (textbox, custom select box, etc) should be displayed. The number of each type of field will vary from time to time. Using ASP I would have either used XSL to create a form or DOM to walk through the contents of the XML and display/name the proper fields. Using .NET I'm not sure what the proper method is to accomplish my goal. I can use XML c...

getting start with and crystal repots(web form)
I use Crystal Report9 in Visual Studio.NET 2003..... Example at Northwind database I want a application that.....a form include a combobox that contain CustomerID.....If I choose one CustomerID and click OK button....a Report will display information about this Customer......I think that must use to do that ???? (How do I start to coding --please step by step or sample) please help me !!! Thank you so much!!! very good I have Dropdownlist when I choose the 'month'--> the all data of this field will show I use this Private Sub ddlMonth_Sel...

Really need help with disabled web forms in visual 2003
Hi, I've posted in the ASP.NET forum as someone suggested, but I got no response and am still unable to use the software. In Visual Studio .NET 2003, with .NET Framework 1.1, all web form controls (in fact all controls in the toolbar) are disabled. I create a webform.aspx page, I AM in design view, but when I go to the "web forms" toolbar, I cannot drag anything to the page because all the controls are disabled (the toolbar is visible, just everything within it is disabled). I solved this last time by completely wiping my drive and spending three days reinstalling and updating everythin...

Just need some help getting started and not sure where to go for help!
Hello All, My company is interested in hosting Exchange 2003, i have read this list and figured out I need to use some combo of MPS, MOM DCAM, MOM DB, EXCH Back-end, EXCH Front-End, and a couple of AD servers however I am not even sure where to start. We are a MS Parnter and have an SPLA license but we were sent the "Hosted Exchange" media and all it was is EXCH Standard Edition. Is there some documentation somewhere that tells me how to setup the environment and all that is required? I am good at Exchange AD, MOM, SQL, all that in an Enterprise Environment but I have no clue...

help help help with getting started
I have a simple page with this code: <%@ Page Language="vb" Debug="true" %> <%@ import Namespace="System.Data" %> <%@ import Namespace="System.Data.SQLClient" %> <script runat="server"> sub Page_load(Sender As Object, E As EventArgs) if not ispostback then 'create connection Dim Conn As SqlConnection = New SqlConnection 'create data adapter Dim dataAdapter As SqlDataAdapter = New SqlDataAdapter 'create dataset Dim dataview...

Need HELP with adding a System.Windows.Forms control to web form!
Howdy folks. I'm in need of some help. I wanted to add a nifty little Control I made for a Windows Form to an ASP.NET page. Now I went and saw Microsoft's quickstart tutorial, and followed the example... You know, compile it to .dll... blah, blah, blah, then use the <OBJECT> tag to insert it into the page. Well, I did all that... the control downloads... but I can't see a thing! :'( For example, here's some code ~ using System; using System.Windows.Forms; using System.Drawing; using System.Reflection; [assembly:AssemblyVersion("")] ...

Noobie Help
Hi,I'm tyring to build a very simple code sample that does a DB Insert.Here is a code sample I found: HookedOnLINQ db = new HookedOnLINQ("Data Source=(local);Initial Catalog=HookedOnLINQ"); // Adding Records – (1) Create a new object and sub-objects, // (2) Add it to the DataContext collection, (3) Call SubmitChanges // (1) Contacts newContact = new Contacts(); newContact.FirstName = "Troy"; newContact.LastName = "Magennis"; // (2) newContact.Orders.Add(newOrder); db.Contacts.Add(newContact); // (3) db.SubmitChan...

Need Web Form Help!!!
Ok here goes, I need to create an admin form that contains a list of events. This list, I was thinking about using a listbox, but the form needs the ability to select specific events and move them to another listbox. This new list will have to be saved in some way and then be displayed the next time the page is visited. Any ideas of how to accomplish this? Thanks in advance Brian That's a general question, so I'll provide you with a general answer. Create your two listboxes, one that is populated from the database and a blank one. The ideal solution here would be to move your items ...

Need help getting started
Hi there,=20 I'm trying to get started contributing to Firefox OS. I have a few question= s I was hoping you can help me with. I'm thinking about fixing bugs on the clock app. It looks like a useful app= that is in need of some TLC, while being not too complex. Does it make sen= se? Would you rather recommend starting somewhere else? Should I be working on master or another branch (i.e.. v2.1)? Creating my profile with make worked. I can run it in the emulator (WebIDE)= but some unit and integration tests are failing on master. I would really = prefer to start with a...

Need help with web forms
Hi,I am trying to make a web form that kinda works like the windows dataform.  I want to be able to take information from my table and display things in labels and textboxs, but have been having difficulty figuring out how to do this.  Does anyone have a suggestion of how I could make such a form that would be able to add new records, update records, delete records, or even make some inactive?  I also may need to show other related tables according to what the user is doing.  Say you are viewing a customer, so you want to be able to see all of that customers information, ...

Need help getting started
Hello. I'm trying to learn C#. I own two web sites but neither supports ASP.Net. I need an area to test my C# pages. Is there a program I can download to do so? Alex Hello Alex_dude,   Have a look at Visual Web Developper for ASP.NET 2.0 and Webmatrix for ASP.NET 1.1 Webmatrix comes withhis own webserver. For Visual Webdevelopper you need IIS (I think, never checked it out). I suggest you using Visual Webdeveloper as it is free and has the same look and feel as Visual Studio .NET   Good luck and have fun   Leketje   Leketje wrote:For Visual Webdeve...

Need Help Getting Started.... thats a site i'm looking to create my site after.... I'm wanting a database thats easy to use and everything... look it over and give me some ideas... jack Uh? Come again? I'm sorry but you'll have to provide a little more detail of what "ideas" you're looking for here."I would love to change the world, but they won't give me the source code." -unknown...

Getting Started Help Needed
Hi, I'm having some troubles with getting sysbase going for me. I'm not a DBA and need some help. When I try to connect I get an error message that either SYBASE is not running (which it is), or I have a port specified incorrectly. I'm using the default of 5002. Any ideas out there on what I'm doing wrong. Thanks Default is usually 5000, how many installs of Sybase do you have. <Doug_Collins> wrote in message news:C9D15F13B172434B004B972C85256CD3.004B977485256CD3@webforums... > Hi, > I'm having some troubles with getting sysbase going fo...

Help Needed Getting Started
I'm new to .NET Web Development and have downloaded and installed Visual Web Developer Studio 2008 Express. I followed the simple steps in "Create Your First Web Site" on the Start Page. However, I get the following error: Server Error in '/WebSite2' Application. Unable to cast object of type 'System.ServiceModel.Configuration.ServiceHostingEnvironmentSection' to type 'System.ServiceModel.Configuration.ServiceHostingEnvironmentSection'. Description: An unhandled exception occurred during the execution of the current web request. Please review t...

Web resources about - Need help getting started with LINQ -

Nuclear-related sanctions on Iran lifted: EU's Mogherini
Vienna (Austria) (AFP) - Multinational and national nuclear-related sanctions on Iran are lifted following Tehran's compliance with July's atomic ...

Trump slams Cruz as a hypocrite
MYRTLE BEACH, S.C. (AP) — Donald Trump is slamming Republican presidential rival Ted Cruz as a "great hypocrite" for tapping big financial institutions ...

IS attack on Syria's Deir Ezzor kills 75 regime forces: monitor
At least 75 Syrian soldiers and pro-regime militiamen were killed Saturday in a multi-front attack by the Islamic State group on the eastern ...

Taiwan elects first female president - World news - The Guardian
Tsai Ing-wen wins historic victory as voters express dissatisfaction with economy and outgoing leader

President Obama: 3 Year Moratorium on New Coal Mines
Guest essay by Eric Worrall President Obama has just announced a 3 year moratorium on leasing federal land for new coal mines, pending a review ...

X-Men TV Series ‘Legion’ Will Take In A Parallel Universe To The Movies
Speaking before the Television Critics Association today, FX Networks and FX Productions CEO John Landgraf announced the official pickup of the ...

Apple to start charging for iTunes Radio on January 28
Initially launched as a free streaming service in September of 2013, iTunes Radio is about to be subsumed by Apple Music . Translation? The formerly ...

Original 'Grease' Stars Didi Conn & Buddy Pearl Join Fox Production 'Grease Live'
Vanessa Hudgens and Julianne Hough get their party on inside the Fox Winter TCA 2016 All-Star Party held at the Langham Huntington Hotel on Friday ...

Hawaii reports first US case of Zika-linked brain damage
The United States has reported its first case of a newborn suffering from brain damage linked to the mosquito-borne Zika virus that has caused ...

Microsoft to bring Windows Phone’s Word Flow keyboard to iOS
The Word Flow keyboard is one of the defining features of Windows on the phone: It was introduced in Windows Phone 8.1, and it works pretty well. ...

Resources last updated: 1/16/2016 10:06:07 PM