I am using the AToMSFrameWork and I'm using the method find of the CPersistentObject. But I saw at the CClassMap.getSelectFor() and its invoke the mehod m_relationalDatabase.getClauseStringEqualTo... If I want to invoke the criteria Like instead "=" what can I do? I'm passing the Class Product with the attribute Name whith "Tes%".
Thank's,
Andr Ribeiro from Brazil.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You need to use a CRetrieveCriteria instead of a find as you are likely to retrieve multiple records based on your selection criteria.
Try something like the following
dim rc as new CRetrieveCriteria
rc.ClassMap = myProduct.GetClassMap()
rc.WhereCondition.addSelectLike("Name","Tes%")
dim c as CCursor = rc.Perform()
while not c.EOF
myProduct = new Product
c.LoadObject(myProduct)
...
c.NextCursor
end while
- Richard.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I am using the AToMSFrameWork and I'm using the method find of the CPersistentObject. But I saw at the CClassMap.getSelectFor() and its invoke the mehod m_relationalDatabase.getClauseStringEqualTo... If I want to invoke the criteria Like instead "=" what can I do? I'm passing the Class Product with the attribute Name whith "Tes%".
Thank's,
Andr Ribeiro from Brazil.
Hi Andre,
You need to use a CRetrieveCriteria instead of a find as you are likely to retrieve multiple records based on your selection criteria.
Try something like the following
dim rc as new CRetrieveCriteria
rc.ClassMap = myProduct.GetClassMap()
rc.WhereCondition.addSelectLike("Name","Tes%")
dim c as CCursor = rc.Perform()
while not c.EOF
myProduct = new Product
c.LoadObject(myProduct)
...
c.NextCursor
end while
- Richard.
It works! Thank you very much!! Bye.