How to Loop through LINQ results (VB.NET) -


I've got some code to try and loop through the LINQ result, but it does not work.

  public sub-process request (same terms as the system. Web.HttpContext) Implements System.Web.IHttpHandler.ProcessRequest '# # Page content type plain Text is' HttpContext .Current.Response.ContentType = "text / plain" # # query casting as a variable 'dim QS Enforce' (integer) = integer. TRIE PERSES (HTTPTPXX.Content.Request.Connectist ("ID"), Nothing) ## Area using Regional DAC using DDAC. Rule Datacontext '# URI variable to create' DIM Q object '# If the query string PID is not empty' # 'then we want to return the results to the base. The PID 'If no QS is a' # that parents fit within the parent ID Disikbi the 'q = (Regional Area T_Regions _ where r.PID = Select qs _ r.Region) Karere # # # We now write 'Loop' and 'Ressults' for each item in the DAL.bt_Region q HttpContext.Current.Response via the array. Write down (Item Region & amp; VbCrLf) End End If End Use Ends Sub  

Here is an error

Public Member 'Area' type Not found on 'string'. Description: An uncontrolled exception occurred during the execution of the current web request. For more information about the error, review the stack trace and where the code has started it.

Exception Description: System. Missingmail Exception: Public Member 'field' type 'string' was not found.

Source error:

Type 33: 'and ressults line 34: q for every item in line 35:
HttpContext.Current.Response.Write (item.Region & Amp; vbCrLf) line 36:
Next line 37:

source file: e: \ projects \ businesstrader \ App_Code \ handler \ Kshetronakshm Smaikveb line: 35

stack trace:

[Misingmel exception: public members 'area' type 'can not be found on a string'.] Microsoft.VisualBasic.CompilerServices.Container.GetMembers (string username, Boolean Riportrrar) +509081 Microsoft.VisualB asic.CompilerServices NewLateBinding.LateGet (object instant, type, string username, Object [] arguments, String [] ArgumentNames, Type [] TypeArguments, Bool Login [] Copibak) +222 Bitikhandlrskrayjenauto Complet. Process Requests (HTTP Contact References) in: E: \ Projects \ Businessstraders \ Episode + Handler \ AutoAuto Complex VB: 35 systems. Web. CallHandder ExecutionStep. System Web. Http application IE ExecutionStep. Exquisite () +181 system. Web. Http application Execute Phase (IExecutionStep Step, Boolean & Does anyone tell me what I'm doing?

The error message is saying that the bt_regions object type stored in the property are in the string and therefore they do not have a member area Trying to do.

I will double check what type of code is DAL.bt_Regions - It seems that you believe that The class gives something, but it seems that the collection of stars can be returned (perhaps just the field name?). To see what's in it, you can modify the code like this:

  string HttpContextkCurrentkResponsekWrite (items to be printed and amp; vbCrLf) //  

I'll try to add the option (if possible) , Which will instruct the compiler to check such errors from time to time.


Comments