Forum Discussion
We created this function to executed SQL Querys, maybe it is useful for you.
Example of usage:
sqlQueryExecute(server, "update "+database+"table set table_name= 'something' where = 1")
/**
* @method sqlQueryExecute
* @param {string} server IP
* @param {string} query to execute
*/
function sqlQueryExecute(server, query)
{
Log.Message("IF ODBC error... check your firewall for SQL Server port 1433 inbound/outbound");
var ConnectionString = "DRIVER=SQL Server;SERVER="+ server +";UID=user;PWD=user";
// Creates a new connection
var ConnDB = ADO.CreateConnection();
var adoRecSet = ADO.CreateRecordset();
ConnDB.ConnectionString = ConnectionString;
ConnDB.Open();
// Opens a recordset
ConnDB.Execute(query);
Log.Checkpoint("QUERY EXECUTED")
// Closes the connection
ConnDB.Close();
}
Related Content
- 3 years ago
Recent Discussions
- 3 days ago
- 3 days ago