当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript mssql.Connection类代码示例

本文整理汇总了TypeScript中mssql.Connection的典型用法代码示例。如果您正苦于以下问题:TypeScript Connection类的具体用法?TypeScript Connection怎么用?TypeScript Connection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Connection类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: function

const connection2 = new sql.Connection(config, function(err) {
    // ... error checks

    // Stored Procedure

    const request = connection2.request();
    request.input('input_parameter', sql.Int, 10);
    request.output('output_parameter', sql.VarChar(50));
    request.execute('procedure_name', function(err, recordsets, returnValue) {
        // ... error checks

        console.dir(recordsets);
    });
});
开发者ID:typed-contrib,项目名称:node-mssql,代码行数:14,代码来源:multipleconnections.ts

示例2: 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

示例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: async

import * as MsSql from "mssql";
import { Repository } from "./repository";
import { Squirrel } from "./squirrel-model";

console.log("attempting SQL connection");

let connection = new MsSql.Connection({
  user: "dray",
  password: "squirrels",
  server: "localhost",
  port: 50729,
  database: "DrayTest",
  options: {
    encrypt: true
  }
});

let x = async (err: Error) => {
  if (err) {
    console.log("connection failed:", err);
  }
  else {
    console.log("connection successful");
  }

  let repo = new Repository(connection);

  console.log(await repo.getAll());

};
开发者ID:dray-data,项目名称:dray,代码行数:30,代码来源:dray-test.ts

示例5:

/** 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

示例6: 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


注:本文中的mssql.Connection类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。