In Criteria left expression is of type STRING and right expression is of type BIGINT and the operator == is not valid

In Criteria left expression is of type STRING and right expression is of type BIGINT and the operator == is not valid

I am having a problem with the following code.

QBD_Line_6 this is result from a user selecting from a Lookup field
QBD_Type is the field that the Lookup field draws from
QBD_Cost is the form that all the data is drawn from
Cost_per_Pc is a cost associated with each QBD_Type
QBD_Value_Line_6 is the field that the cost should display to the user.


if (input.QBD_Line_6 != null)

{
temp1 = QBD_Cost [QBD_Type == input.QBD_Line_6.toString()];
input.QBD_Value_Line_6 = temp1.Cost_per_Pc;
}


This code gives me the following error when I don't make QBD_Line_6 a string "In Criteria left expression is of type STRING and right expression is of type BIGINT and the operator == is not valid". I have added ".toString()" to fix this problem but no result is being returned. How can I get Cost_per_Pc to display in QBD_Value_Line_6?