I would just look at the field type and format the query accordingly. I haven't tested this but it would look something like this: Public Function GenerateQueryString(ByVal featureClass As IFeatureClass, ByVal fieldName As String, ByVal value As Object) As String
Dim field As IField = featureClass.Fields.Field(featureClass.Fields.FindField(fieldName))
Dim delimiter As String = String.Empty
If field.Type = esriFieldType.esriFieldTypeString Then delimiter = "'"
Dim queryString As String = String.Format("{0} = {1}{2}{1}", fieldName, delimiter, value)
Return queryString
End Function