Hi.
I'm trying to use a Lookup field in a query. When a run it, i've get an error message like this: "Conversion failed when converting the nvarchar value '17B' to data type int."
Here are the query that i'm working on in Visual Studio:
SPQuery query = new SPQuery();
query.Query = "<Where><Eq><FieldRef Name='Class' LookupId='TRUE'/><Value Type='Lookup'>" + classID + "</Value></Eq></Where>";
In my database a have a Lookup column wich name is Class. This column have the value 17;#17B, wich represents the ID and the Text of the field. If both of this two parameters are diferent, my query return the error above, if the values are the same, it works very well. Actually, i need to consult this value passing the first parameter, in this case 17, but my query insists to pass the second parameter, 17B.
Thanks.
Regards.