本文整理汇总了C#中QueryInfo.ExecuteQuery方法的典型用法代码示例。如果您正苦于以下问题:C# QueryInfo.ExecuteQuery方法的具体用法?C# QueryInfo.ExecuteQuery怎么用?C# QueryInfo.ExecuteQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryInfo
的用法示例。
在下文中一共展示了QueryInfo.ExecuteQuery方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecuteQueryTest
public void ExecuteQueryTest()
{
SetupTestDbFb2();
var inf = new QueryInfo();
inf.ExecuteQuery(GetFb2ConnectionString(), "select * from test").ToList()[0].View.Rows.Count.Is(0);
var result = inf.ExecuteQuery(GetFb2ConnectionString(), "insert into test(int_test, char_test) values (1, 'aaaaaaaaaa');update test set varchar_test = 'testtesttesttest' where int_test = 1;select * from test").ToList();
result[0].View.Rows[0].Is(x => ((string)x[0]).Contains("実行しました。"));
result[1].View.Rows[0].Is(x => ((string)x[0]).Contains("更新しました。"));
result[2].View.Rows.Count.Is(1);
}
示例2: ExecuteQueryTestFb3
public void ExecuteQueryTestFb3()
{
SetupTestDbFb3();
var inf = new QueryInfo();
var conStr = GetFb3ConnectionString();
inf.ExecuteQuery(conStr, "select * from test").ToList()[0].View.Rows.Count.Is(0);
var result = inf.ExecuteQuery(conStr, "insert into test values (1, 123456789000, null, '12asd', '2016-07-24', 50000, 2.5, 2.5555, 4500, 10, '10:00:00', current_timestamp, 'asdfghjk', true);update test set varchar_test = 'testtesttesttest' where int_test = 1;select * from test").ToList();
result[0].View.Rows[0].Is(x => ((string)x[0]).Contains("実行しました。"));
result[1].View.Rows[0].Is(x => ((string)x[0]).Contains("更新しました。"));
result[2].View.Rows.Count.Is(1);
}
示例3: SetCommand
public void SetCommand()
{
CreateDatabase = new RelayCommand(async () =>
{
var vm = new NewDatabaseSettingsViewModel();
MessengerInstance.Send(new MessageBase(vm, "NewDbSettingsWindowOpen"));
if (string.IsNullOrEmpty(vm.Path)) return;
var db = new DbViewModel();
await db.CreateDatabase(vm.Path, vm.Type, vm.CharSet);
Databases.Add(db);
_history.DataAdd(vm.Path);
});
LoadDatabase = new RelayCommand<string>(async (path) =>
{
if (string.IsNullOrEmpty(path)) return;
if (!File.Exists(path)) return;
var dbInf = new DatabaseInfo(new FirebirdInfo(path));
if (!dbInf.CanLoadDatabase) return;
var db = new DbViewModel();
Databases.Add(db);
await db.LoadDatabase(dbInf);
_history.DataAdd(path);
});
ExecuteQuery = new RelayCommand(async () =>
{
if (CurrentDatabase == null || !CurrentDatabase.CanExecute()) return;
if (TagSelectedValue.IsNewResult && 0 < Datasource[0].Result.Count) Datasource[0].Pined = true;
var QueryResult = Datasource[0];
QueryResult.Result.Clear();
await Task.Run(() =>
{
var inf = new QueryInfo { ShowExecutePlan = TagSelectedValue.IsShowExecutionPlan };
QueryResult.GetExecuteResult(inf, CurrentDatabase.ConnectionString, TagSelectedValue.Query);
});
});
DropFile = new RelayCommand<string>((string path) =>
{
InputPath = path;
RaisePropertyChanged(nameof(InputPath));
});
DbListDropFile = new RelayCommand<string>((string path) =>
{
LoadDatabase.Execute(path);
});
SetSqlTemplate = new RelayCommand<SqlKind>((SqlKind sqlKind) =>
{
TagSelectedValue.Query = CreateSqlSentence(SelectedTableItem, sqlKind);
RaisePropertyChanged(nameof(Queries));
});
ExecLimitedSql = new RelayCommand<string>((count) =>
{
TagSelectedValue.Query = CreateSqlSentence(SelectedTableItem, SqlKind.Select, int.Parse(count));
RaisePropertyChanged(nameof(Queries));
ExecuteQuery.Execute(null);
});
ExecSqlTemplate = new RelayCommand<SqlKind>((SqlKind sqlKind) =>
{
SetSqlTemplate.Execute(sqlKind);
ExecuteQuery.Execute(null);
});
ShutdownDatabase = new RelayCommand(() => { Databases.Remove(CurrentDatabase); });
ChangeConfig = new RelayCommand(() =>
{
if (CurrentDatabase == null) return;
var vm = new ConnectionSettingsViewModel(CurrentDatabase.DbInfo);
MessengerInstance.Send(new MessageBase(vm, "WindowOpen"));
});
ShowEntity = new RelayCommand(() =>
{
if (CurrentDatabase == null) return;
var vm = new EntityRelationshipViewModel(CurrentDatabase);
MessengerInstance.Send(new MessageBase(vm, "EintityWindowOpen"));
});
AddTab = new RelayCommand(() =>
{
TagSelectedValue.Header = $"Query{Queries.Count}";
Queries.Add(QueryTabViewModel.GetNewInstance());
RaisePropertyChanged(nameof(Queries));
});
DeleteTabItem = new RelayCommand(() =>
{
var item = TagSelectedValue;
var idx = Queries.IndexOf(item);
TagSelectedIndex = idx - 1;
//.........这里部分代码省略.........