當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Connection.close方法代碼示例

本文整理匯總了TypeScript中mssql.Connection.close方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Connection.close方法的具體用法?TypeScript Connection.close怎麽用?TypeScript Connection.close使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在mssql.Connection的用法示例。


在下文中一共展示了Connection.close方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: function

var connection = new mssql.Connection (config, function (err)
	{
	var request = new mssql.Request(connection);

	var command: string = sql_manipulate.delete_command_gen (id_in);

	request.query (command, function(err, rows)
		{
		if (err) throw err;

		console.log ("*** 終了 ***");
		});

	connection.close ();

});
開發者ID:ekzemplaro,項目名稱:data_base_language,代碼行數:16,代碼來源:mssql_delete.ts

示例2: function

request.query (command, function (err, rows)
	{
	for (var key in dict_aa)
		{
console.log (key);
		var sql_str: string  = "insert into cities ";
		sql_str += "(id,name,population,date_mod) values (";

		var str_data: string = "'" + key + "','" + dict_aa[key].name;
		str_data += "'," + dict_aa[key].population;
		str_data += ",'" + dict_aa[key].date_mod + "')";

		sql_str += str_data;
			request.query (sql_str);
		}

	connection.close ();
	console.log ("*** 終了 ***");
	});
開發者ID:ekzemplaro,項目名稱:data_base_language,代碼行數:19,代碼來源:mssql_create.ts

示例3: function

var connection = new mssql.Connection (config, function (err)
	{
	var request = new mssql.Request(connection);

	var str_sql: string = "select * from cities";

	request.query (str_sql, function(err, rows)
		{
		for (var it in rows)
			{
			var str_out: string = rows[it].id + "\t";
			str_out += rows[it].name + "\t";
			str_out += rows[it].population + "\t";
			str_out += rows[it].date_mod;
			console.log (str_out);
			}

		console.log ("*** 終了 ***");
		});

	connection.close ();

});
開發者ID:ekzemplaro,項目名稱:data_base_language,代碼行數:23,代碼來源:mssql_read.ts

示例4:

/** Samples from https://github.com/patriksimek/node-mssql#connection */

import * as sql from "mssql";

/**
 * connect https://github.com/patriksimek/node-mssql#connect-callback
 */

const connection = new sql.Connection({
    user: '...',
    password: '...',
    server: 'localhost',
    database: '...'
});

connection.connect(function(err) {
    // ...
});

/**
 * close https://github.com/patriksimek/node-mssql#close
 */

connection.close();

開發者ID:typed-contrib,項目名稱:node-mssql,代碼行數:24,代碼來源:connection.ts


注:本文中的mssql.Connection.close方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。