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


C# QueryInfo.ExecuteQuery方法代码示例

本文整理汇总了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);
        }
开发者ID:degarashi0913,项目名称:FAManagementStudio,代码行数:11,代码来源:ConnectionTestFb2.cs

示例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);
        }
开发者ID:degarashi0913,项目名称:FAManagementStudio,代码行数:12,代码来源:ConnectionTestFb3.cs

示例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;
//.........这里部分代码省略.........
开发者ID:degarashi0913,项目名称:FAManagementStudio,代码行数:101,代码来源:MainViewModel.cs


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