本文整理汇总了C#中DbHelper.ExecuteArray方法的典型用法代码示例。如果您正苦于以下问题:C# DbHelper.ExecuteArray方法的具体用法?C# DbHelper.ExecuteArray怎么用?C# DbHelper.ExecuteArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DbHelper
的用法示例。
在下文中一共展示了DbHelper.ExecuteArray方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TryLoadDatabases
public void TryLoadDatabases()
{
try
{
var builder = new SqlConnectionStringBuilder();
builder.DataSource = Model.Server;
builder.IntegratedSecurity = !Model.IsSqlServerSecurity;
if (Model.IsSqlServerSecurity)
{
builder.UserID = Model.Username;
builder.Password = Model.Password;
}
builder.InitialCatalog = "master";
var helper = new DbHelper(builder.ConnectionString);
var databases = helper.ExecuteArray<string>("select [name] from sys.databases where name not in ('master', 'tempdb','model','msdb') order by [name]");
DatabasesComboBox.ItemsSource = databases;
}
catch (Exception ex)
{
MessageBox.Show("The following error occurred while trying to populate the list of databases:\t\t" + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
}