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
nikoo.malek1.3927635000918623E12nikoo.malek1.3927635000918623E12 

How pass variable to SOQL where clause

I am using sales force API with C#. in the query that I am writing I am not sure how pass parameter to the select query. My query works when it looks like this:
            SOQL = "select AuthorId,Name, Description,Type from Document where AuthorId='005G0000003s4a8IAA'";     

But I am not sure how to replace the value in AuthorId that is '005G0000003s4a8IAA' to variable that I am passing to this method like: id?
sfdc_ninjasfdc_ninja
You need to add the variable to end of the string, and make sure that its wrapped in quotes itself.  Something like

string a = myAuthor.Id
SOQL = "select AuthorId, Name, Description, Type from Document where AuthorId='" + a + "'";