You need to sign in to do that
Don't have an account?
Classic ASP code executes a successful query but cannot get result
Hi. I'm using classic ASP and the 4.0 version of the SForceOfficeToolkitLib to run a simple select query to retrieve the unitprice value from a record in the PricebookEntry object. The query runs fine, but when I do the "for x in y" where y is hte queryresultobject, the code inside the "for" loop is not giving me the answer. I have a response.write immediately after the line where I move the query item into a variable, but the variable is not being printed out. There's no error message - it's as if it's not going into the "For" loop at all. I queried the "size" value and it equals 1, which is what I expect as I'm trying to get the unit price for a single part number in the pricebook entry object. Here's the code. Can anyone tell me why the UnitPrice is not coming back to me? pbID is a parameter containing the pricebook ID and rs is a ADO (Active Data Object) recordset object containing the part number I want to query. The queryresult object is created when the line of code executes that says "Set SFPrices = sfdc.query(strSQL, false)" However, I don't have a class string to create the sObject4. Could that be the problem??
strSQL = "Select UnitPrice from PricebookEntry where Pricebook2Id = '" & pbID & "' and ProductCode = '" & rs("ITEM_NUMBER") & "'"
Set SFPrices = sfdc.Query(strSQL, False)
If sfdc.Error = NO_SF_ERROR Then
If SFPrices.Size > 0 Then
For Each SFPrice In SFPrices
vPrice = SFPrice.item("UnitPrice")
Response.Write " price = " & vPrice
Next
else
vPrice = 0
strERR = "This part is not active in the selected price book"
End if
else
Response.Write "Cannot make a connection to Salesforce"
End if
figured it out. There's nothing wrong w/ the code, but i was starting my salesforce session in a sandbox, and apparently, it doesn't jive with the 4.0 version of the toolkit. I changed the session login to log into production, and the unit prices came back just fine!