Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Accessing collection property
Message
 
 
À
08/09/2008 15:28:56
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01345879
Message ID:
01345888
Vues:
9
>>My question is - how can I access this _fieldID in my code?
>>I need to check _fieldID for some specific string, what would be my syntax?
>
>As I can see in source code _fieldID is private field used by public property FieldId of SqlWhereBuilderCondition class
>
>private string _fieldId = "";
>///
>/// The string identifier for the SqlWhereBuilderField used in this condition
>///

>public string FieldId
>{
> get {return _fieldId;}
> set {_fieldId = value;}
>}
>
>
>You can access this property simply
>
>mySWBuilder.Conditions[0].FieldId
>
>Maybe I misunderstand your goal?

Hi Roman,

My goal was to check if a specific condition was selected. I looped through Conditions collection and checked it with this code
if (this.SqlWhereBuilderPeople.Conditions.Count > 0)
        {
            for (int i=0; i < this.SqlWhereBuilderPeople.Conditions.Count; i++) 
            {
                if (this.SqlWhereBuilderPeople.Conditions[i].FieldId.Equals("IsActive"))
                {
                    // Remove IsActive part in case we selected that condition - very rare case
                    RemoveIsActivePart = true;
                }
    
            }  

            qry_s = qry_s + " AND (" +
               this.SqlWhereBuilderPeople.GetWhereClauseWithParameters(Command) + ") ORDER BY LastName, FirstName";
            
            
            SearchCriteriaNotEmpty = true;
        }
I'm wondering if this is the correct way or there is a better and simpler way.

BTW, are you using this class in your project as well?
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform