Skip to main content

Posts

Showing posts from May, 2015

Several options for providing query parameters to 'queryExecute' function

The params argument of the queryExecute() function can be passed in a number of forms.  Using an object or a structure will allow named query parameters, while the array method necessitates the question mark (?) placeholders. Because of this difference, the SQL variable has been defined twice, once in each manner.  The query is run and the result is dumped in the final example. Object and structure methods // Params definition option 1. var sqlParams =     {         firstParam: "FIELD VALUE",         secondParam: "FIELD VALUE"     } // Params definition option 2. var sqlParams = structNew (); sqlParams . firstParam = "FIELD VALUE" ; sqlParams . secondParam = "FIELD VALUE" ; // Params definition option 3. var sqlParams = structNew (); sqlParams [ "firstParam" ] = "FIELD VALUE" ; sqlParams [ "secondParam" ] = "FIELD VALUE" ; var sql = "     declare @returnValue nvarchar(255)     exec