function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mdkmdk 

malformed query error

Hey Guys,

Im trying to determine whether or not a contact already exists with an existing account. here is the query that I'm using:

Dim qryc As sForceAPI.QueryResult = binding.query("select id from contact where (FirstName = '" & Me.txtAdminFirstName.Value.Trim & "' and LastName = '" & Me.txtAdminLastName.Value.Trim & "') and accountid = " & qryRecordsAccount(0).Id)

Dim qryRecordsC() As sForceAPI.sObject = qryc.records

Just so you know, qryRecordsAccount(0).id gets the account id and it works but just to be complete, here is the definition for qryRecordsAccount:

Dim qryAccount As sForceAPI.QueryResult = binding.query("select id, name from Account where name = '" & Me.txtAccountName.Value.Trim & "'")

Dim qryRecordsAccount() As sForceAPI.sObject = qryA.records

 When I try to run this code I get the following error when it reaches the dim qryc as.... line above:

server error in'/' application

malformed_query: malformed query: expecting EOF, found 'sZZAAY'

The error references this line of code:

Line 265:            Dim results() As Object = Me.Invoke("query", New Object() {queryString})

Source File: C:\LiveWebs\www.visualboardbook.com\Web References\sForceAPI\Reference.vb    Line: 265

 

Please Help!

mdk

SuperfellSuperfell
The final clause that has the Id needs to have ' around the id value, e.g.

and accountid = '" & qryRecordsAccount(0).Id & "'"


SforceExplorer is great for trying out your SOQL queries. http://sforce.sf.net/

Message Edited by SimonF on 05-25-2005 10:47 AM

mdkmdk
My bad. Thanks a lot!