function Insert()

in sqllinuxbook/ch4/customerappinssel.js [24:44]


function Insert(FullName, PreferredName, Logon, callback) {
  console.log("Inserting '" + FullName + "' into Table...");

  request = new Request(
    'INSERT INTO [Application].[People] ([FullName], [PreferredName], [IsPermittedToLogon], [LogonName], [IsExternalLogonProvider], [IsSystemUser], [IsEmployee], [IsSalesPerson], [LastEditedBy]) VALUES (@FullName, @PreferredName, 1, @Logon, 0, 1, 1, 0, 0);',
      function(err, rowCount, rows) {
      if (err) {
          console.log(err);
          callback(err);
      } else {
          console.log(rowCount + ' row(s) inserted');
          callback(null);
      }
      });
  request.addParameter('FullName', TYPES.NVarChar, FullName);
  request.addParameter('PreferredName', TYPES.NVarChar, PreferredName);
  request.addParameter('Logon', TYPES.NVarChar, Logon);

  // Execute SQL statement
  connection.execSql(request);
}