Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7856429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T20:42:32+00:00 2026-06-02T20:42:32+00:00

i got this error: Compiler Error Message: CS1001: Identifier expected from this set of

  • 0

i got this error:

Compiler Error Message: CS1001: Identifier expected

from this set of code:

var reqcategory=""; 
        foreach(Request["category"] as reqcategory)
        {
        var sql5 = "SELECT Type.PreReq1, Type.PreReq2, (CASE WHEN (Type.PreReq1 IS NOT NULL) AND (PermitApp1.RPClass IS NULL) AND (PermitApp1.RPCategory IS NULL) THEN 1 ELSE 0 END) AS missing1, (CASE WHEN (Type.PreReq2 IS NOT NULL) AND (PermitApp2.RPClass IS NULL) AND (PermitApp2.RPCategory IS NULL) THEN 1 ELSE 0 END) AS missing2 FROM Type LEFT JOIN PermitApp AS PermitApp1 ON (Type.PreReq1=PermitApp1.RPClass) OR (Type.PreReq1=PermitApp1.RPCategory) AND ( PermitApp1.CDSID = @0 ) AND (PermitApp1.MDecision='1') LEFT JOIN PermitApp AS PermitApp2 ON (Type.PreReq2=PermitApp2.RPClass) OR (Type.PreReq2=PermitApp2.RPCategory) AND ( PermitApp2.CDSID = @1 ) AND (PermitApp2.MDecision='1') WHERE Type.PType = @2";
        var result = db.QuerySingle(sql5, myCDSID, myCDSID, reqcategory);
        var miss1 = result.missing1;
        var miss2 = result.missing2;
        }

The error happens to fall on this line:

foreach(Request["category"] as reqcategory)

as highlighted by the compiler.

Can anyone tell me what is my mistake?? And How should i declare a identifier??

Anyway what is an identifier? I cant seem to undertstand the explaination in http://msdn.microsoft.com/en-us/library/b839hwk4(VS.80).aspx

If its int i will use int.parse right but if it is string…how can i do so?

Thanks Thanks

BTW I am using webmatrix…

After i used JaredPar’s solution…the next error came…

CS1026: ) expected

in this part:

if (miss1 == '1' or miss2 == '1'){
            ModelState.AddError("missing", "You have not met the Pre-Requisites for "+ cat +" yet.")
            } else if (miss1 == '0' and miss2 == '0'){

        Session["license"] = Request["licence"];
        Session["from"] = Request["from"];
        Session["to"] = Request["to"];
        Session["group"] = Request["group"];
        Session["class1"] = Request["class1"];
        Session["category1"] = Request["category1"];
        Session["class"] = Request["class"];
        Session["category"] = Request["category"];
        Response.Redirect("~/Questionnaire");
        }

on this line:

if (miss1 == '1' or miss2 == '1'){

Thanks…I don’t see why i need a ‘(‘ there…as i have closed all of it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T20:42:36+00:00Added an answer on June 2, 2026 at 8:42 pm

    The problem is you have the structure of the foreach loop backwards. In C# it’s identifire in collection.

    foreach(var reqcategory in Request["category"]) { 
      ...
    } 
    

    Note that even this won’t be enough though as Request[...] returns object which isn’t a valid collection type in C#. You’ll need to specify the type of the underlying collection or use dynamic. The safest choice is a cast to IEnumerable

    foreach(object reqcategory in (IEnumerable)Request["category"]) { 
      ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got this error message from the C++ compiler: CC: Fatal error in ccfe:
I got this error message when trying to compile my code: btree.h:23: error: expected
I got this error from XCode: objc[8422]: FREED(id): message release sent to freed object=0x3b120c0
Got this error message while trying to configure an entitydatasource in the designer: My
I got this error message and I'm not quite sure whats wrong: Exception in
got this code from a website that helped me in creating buttons and stuff.
Got this error on a big $_GET query in size ~9 000 symbols (they
I got this error for a collection I am writing, but fxcop warned me
I got this error twice. it says error: redefinition of '-[SampleTableViewController tableView:cellForRowAtIndexPath:]'
I got this error running a query that goes against 2 tables with combined

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.