本文整理汇总了C#中System.Data.SqlClient.SqlConnectionStringBuilder.Connection方法的典型用法代码示例。如果您正苦于以下问题:C# SqlConnectionStringBuilder.Connection方法的具体用法?C# SqlConnectionStringBuilder.Connection怎么用?C# SqlConnectionStringBuilder.Connection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.SqlClient.SqlConnectionStringBuilder
的用法示例。
在下文中一共展示了SqlConnectionStringBuilder.Connection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PerfTest
private static void PerfTest()
{
SqlConnectionStringBuilder database = new SqlConnectionStringBuilder(connectionString);
using (var connection = database.Connection())
{
connection.Open();
var results = connection.QuerySql<PerfTestData>("SELECT Int=1, String='2', Decimal=3, [Double]=4");
PerformanceTest.WithDurationAndKeyWait(3, 1 * 1000, () =>
{
results = connection.QuerySql<PerfTestData>("SELECT Int=1, String='2', Decimal=3, [Double]=4");
});
}
}
示例2: SqlConnectionStringBuilder_Connection
static void SqlConnectionStringBuilder_Connection()
{
SqlConnectionStringBuilder database = new SqlConnectionStringBuilder(connectionString);
// make other changes here
// run a query right off the connection (this performs an auto-open/close)
database.Connection().QuerySql("SELECT * FROM Beer", Parameters.Empty);
}