You must Sign In to post a response.
  • Category: .NET

    Pls tell me ,how can solve dis below error,the below statement is a c# statement.

    C# STATEMENT: foreach ( sColn in tblList .Columns)

    ERROR MSG:Type and identifier are both required in a foreach statement
  • #583127
    The syntax of foreach is :

    foreach(datatype variable in collection)

    in your case you want to access each column of the table, but you didn't specify the datatype of sColn.

    And also for your older messages, whenever you get an error like "...method doesn't except 'n' number of arguments" that means you are specifying either more or less than allowed parameters/arguments to the method.

  • #583142
    Please check the following code:


    foreach (DataColumn sColn in tblList.Columns)


    Thanks & Regards
    Paritosh Mohapatra
    Microsoft MVP (ASP.Net/IIS)
    DotNetSpider MVM

  • #583153
    here
    datatype of Scol is missing so that error comes

    Use as like

    foreach (DataColumn sCol in tblList.Columns)

    Thanks
    ketan

  • #583197
    try this code


    foreach(DataColumn in tblList .Columns)
    {
    //your code
    }



    hope this will help you


  • This thread is locked for new responses. Please post your comments and questions as a separate thread.
    If required, refer to the URL of this page in your new post.