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


C# ConnectionInfo.Query方法代码示例

本文整理汇总了C#中ConnectionInfo.Query方法的典型用法代码示例。如果您正苦于以下问题:C# ConnectionInfo.Query方法的具体用法?C# ConnectionInfo.Query怎么用?C# ConnectionInfo.Query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ConnectionInfo的用法示例。


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

示例1: ExecuteQuery

 private static void ExecuteQuery(ProfileItem item, ConnectionInfo info, PlaybackItem playbackItem)
 {
     try
     {
         info.QueryParameters = item.GetQueryParameters();
         var results = info.Query(re.Replace(item.Query, string.Empty));
     }
     catch (Exception e)
     {
         playbackItem.QueryTab.AppendLogTabLine(string.Format("{0} {1}", item.Query, e));
     }
 }
开发者ID:rbramwell,项目名称:OrionSDK,代码行数:12,代码来源:PlaybackManager.cs

示例2: AddServer

        public void AddServer(IMetadataProvider provider, ConnectionInfo connection)
        {
            //Check if the current connection can create subscription
            DataTable dt = null;

            try
            {
                dt = connection.Query("SELECT CanCreate FROM Metadata.Entity WHERE FullName='System.Subscription'");
            }
            catch (ApplicationException e)
            {
                log.Info("Exception checking if we can create subscriptions.", e);
            }

            if (dt != null && (dt.Rows.Count == 1 && dt.Columns.Count == 1))
            {
                connection.CanCreateSubscription = Convert.ToBoolean(dt.Rows[0][0]);
            }

            var tableContextMenu = new ContextMenu();
            tableContextMenu.MenuItems.Add("Generate Select Statement", (s, e) => GenerateSelectStatement(_contextMenuNode.Tag as Entity, false));
            tableContextMenu.MenuItems.Add("Generate Select Statement (with Inherited Properties)", (s, e) => GenerateSelectStatement(_contextMenuNode.Tag as Entity, true));

            if (connection.CanCreateSubscription)
                tableContextMenu.MenuItems.Add("Subscribe", StartSubscription);

            _tableContextMenuItems.Add(connection.Title, tableContextMenu);

            var serverContextMenu = new ContextMenu();
            serverContextMenu.MenuItems.Add("Refresh", (s, e) => RefreshServer(_contextMenuNode));

            if (connection.CanCreateSubscription)
                serverContextMenu.MenuItems.Add("Activity Monitor", (s, e) => OpenActivityMonitor(_contextMenuNode));

            serverContextMenu.MenuItems.Add("Generate C# Code...", (s, e) => GenerateCSharpCode(_contextMenuNode));
            serverContextMenu.MenuItems.Add("Close", (s, e) => CloseServer(_contextMenuNode));

            _serverContextMenuItems.Add(connection.Title, serverContextMenu);


            TreeNode node = CreateDatabaseNode(provider, connection);

            TreeNode[] existingNodes = _tree.Nodes.Find(node.Name, false);
            if (existingNodes.Length == 0)
            {
                // Node doesn't already exist.  Add it
                _tree.Nodes.Add(node);
                _tree.SelectedNode = node;
                RefreshServer(node);
            }
            else
            {
                // Node exists.  Just focus on it.
                _tree.SelectedNode = existingNodes[0];
            }

            connection.ConnectionClosed += (o, e) =>
            {
                _tableContextMenuItems.Remove(connection.Title);
                tableContextMenu.Dispose();
                tableContextMenu = null;

                _serverContextMenuItems.Remove(connection.Title);
                serverContextMenu.Dispose();
                serverContextMenu = null;
            };
        }
开发者ID:rbramwell,项目名称:OrionSDK,代码行数:67,代码来源:ObjectExplorer.cs


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