So, here is some lines of code that I write to retrieve data from SharePoint list using CAML query.
string qryCaml = string.Format(
@"<Where>
<And>
<Eq>
<FieldRef Name='{0}'/>
<Value Type='Text'>{1}</Value>
</Eq>
<Eq>
<FieldRef Name='{2}'/>
<Value Type='Text'>{3}</Value>
</Eq>
</And>
</Where>", QueryFieldName1, QueryValue1, QueryFieldName2, QueryValue2);
As you can see in the code, I declare all the Value Type as 'Text'.
So, even though the column has a Value Type of Choice/Lookup, the code will still run the value type as Text, and things goes smoothly without any issues.
My questions are, is it better to specified the value type? and is there any performance difference between specifying the value type than just stated it as 'Text'(Maybe faster queries)?
I'm very new to SharePoint and I want my code to be as dynamic as possible, that's why I put all the Value Type as Text.
Thank you.