sqlWrite

Uses a standard update or insert statement. See SQL Statements for how to create statements.

Demo

Parameters

  1. statementName - The name of the statement

  2. additionalParameters - all controls in the current config are set as paramters automatically. If you need to add additional parameters, you can use this json object to set them

  3. queryOptions - (optional) a json object with options for the request

    • timeout - (optional) timeout for the SQL Request. Default is 30 seconds

    • connectionKey - (optional) a key to a custom settings entry with the connection string to an external MSSQL database

Example Usages

Lets assume, we have a standard statement "update address set adrName = @newName"

   let result = await brixxApi.sqlWrite("updateAddress"); //this will use the statement "updateAddress". The @newName parameter is set to the field Value of "newName" of the app where we use this function
   console.log("Rows changed: " + result);
   <syntaxhighlight>

   <syntaxhighlight lang="js">
   let result = await brixxApi.sqlWrite("readAddress", {newName: "Hello World"}); //this will use the statement "updateAddress". The @newName parameter is set to "Hello World"
   console.log("Rows changed: " + result);
   let result = await brixxApi.sqlWrite("readAddress", {newName: "Hello World"}, {timeout: 45}); //this will wait for 45 seconds until you get a timeout
   console.log("Rows changed: " + result);

Last updated