+ Start a Discussion
jousterjouster 

Cannot convert type 'sforce.sObject' to 'sforce.Quote'

Writing a c#.net program and I get this error on my server, but not my local machine. Any ideas on why its different?

 

Here is the line of code in question:

 

opp = (Quote)qr.records[i];

 

Thanks.

ocortinasocortinas

Maybe what is happening is the query is not returning any quotes, be sure the query return some quotes. Other thing is that the query you use to obtain that list of quotes is not getting all the field related to quotes and then the content of SObject didn't match with the content of a Quote object.

Chack that, or give me more information about the query you use to get that list of quotes or how are you getting the content for qr.records.