How to use mssql.open


hi,

can me exact syntax of mssql.open function documentation of seems incomplete.

for better or worse, docs sparse on - basic documentation @ http://msdn.microsoft.com/en-us/library/windowsazure/jj554212.aspx  you've been there.  there small link on page github page corresponding node package (as couple of important caveats use in mobile services vs "regular".) https://github.com/windowsazure/node-sqlserver

the big things are:

  1. you not provide connection string...mobile services handles behind scenes connecting db attached mobile service (other posts exist using other packages connecting other databases.)
  2. where msdn content mentions "options", means use success/error callback function options use elsewhere in mobile services scripts.  success callback open include "connection" object parameter.  error callback received description of error occurred.  believe more insight operations can performed on connection object defined in code @ https://github.com/windowsazure/node-sqlserver/blob/master/src/connection.cpp

so ultimately, open, sample given in msdn docs is:

function insert(item, user, request) {
    mssql.open({
        success: function(connection) {
            connection.query(//query execute);
            connection.query(//query execute)
            // etc
        }
    }
}

you're calling open, giving object parameters includes success (and perhaps error) callback function.  function receives connection object can perform multiple queries, transactions, , basic reads.  query syntax mimics query syntax seen in other examples on msdn page (and other sources, such http://www.windowsazure.com/en-us/develop/mobile/how-to-guides/work-with-server-scripts/)  rest of isn't documented in github content, source code there can allow inferences made how works.



Microsoft Azure  >  Azure Mobile Apps



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'