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


C# OleDbCommand.GetDouble方法代码示例

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


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

示例1: GetReportData

        public static List<AvgSpeedReportItem> GetReportData()
        {
            string query =
@"WITH RankedLink AS (
		SELECT ROW_NUMBER() OVER (ORDER BY Link, SegEndC) [Number], *
		FROM dbo.Olaine_LINK_EVAL),
	MiddleLink AS (
		SELECT AVG(Number) [MiddleLink]
		FROM RankedLink
		GROUP BY Link),
	AvgSpeed AS (
		SELECT AVG(v__0_) [speed], Link
		FROM dbo.Olaine_LINK_EVAL
		GROUP BY Link)

SELECT RankedLink.Link, 0 [Lane], (SegStX + SegEndX)/2 [center.x], (SegStY + SegEndY)/2 [center.y], AvgSpeed.speed
FROM RankedLink
	JOIN MiddleLink ON RankedLink.Number=MiddleLink.MiddleLink
	JOIN AvgSpeed ON RankedLink.Link=AvgSpeed.Link";

            var list = new List<AvgSpeedReportItem>();

            try
            {
                var sb = new OleDbConnectionStringBuilder(vissim.Instance.Evaluation.Wrap().GetConnectionString());
                if (sb.ContainsKey("Password"))
                {
                    using (var conn = new OleDbConnection(sb.ConnectionString))
                    {
                        conn.Open();
                        try
                        {
                            using (var reader = new OleDbCommand(query, conn).ExecuteReader())
                            {
                                while (reader.Read())
                                {
                                    list.Add(new AvgSpeedReportItem()
                                    {
                                        Link = reader.GetInt32(0),
                                        Lane = reader.GetInt32(1),
                                        Center = new Point(reader.GetDouble(2), reader.GetDouble(3)),
                                        AvgSpeed = reader.GetDouble(4)
                                    });
                                }
                            }
                        }
                        finally
                        {
                            conn.Close();
                        }
                    }
                }
            }
            catch { }

            return list;
        }
开发者ID:A-n-d-r-e-y,项目名称:VISLAB,代码行数:57,代码来源:Analyst.cs

示例2: GetSegments

        public static List<Line> GetSegments()
        {
            string query = @"select Link, Lane, SegStX, SegStY, SegEndX, SegEndY from dbo.Olaine_LINK_EVAL";

            var list = new List<Line>();

            var sb = new OleDbConnectionStringBuilder(vissim.Instance.Evaluation.Wrap().GetConnectionString());
            if (sb.ContainsKey("Password"))
            {
                using (var conn = new OleDbConnection(sb.ConnectionString))
                {
                    conn.Open();
                    using (var reader = new OleDbCommand(query, conn).ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            list.Add(new Line()
                            {
                                X1 = reader.GetDouble(2),
                                Y1 = reader.GetDouble(3),
                                X2 = reader.GetDouble(4),
                                Y2 = reader.GetDouble(5),
                                Stroke = Brushes.Red
                            });
                        }
                    }
                }
            }

            return list;
        }
开发者ID:A-n-d-r-e-y,项目名称:VISLAB,代码行数:31,代码来源:Analyst.cs

示例3: GetPoints

        public static List<Ellipse> GetPoints(int size)
        {
            string query = @"select Link, Lane, SegStX, SegStY, SegEndX, SegEndY from dbo.Olaine_LINK_EVAL";

            var list = new List<Ellipse>();

            var sb = new OleDbConnectionStringBuilder(vissim.Instance.Evaluation.Wrap().GetConnectionString());
            if (sb.ContainsKey("Password"))
            {
                using (var conn = new OleDbConnection(sb.ConnectionString))
                {
                    conn.Open();
                    using (var reader = new OleDbCommand(query, conn).ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            list.Add(new Ellipse()
                            {
                                Height = size,
                                Width = size,
                                Fill = Brushes.Red,
                                Stroke = Brushes.Red,
                                Tag = new Point(reader.GetDouble(2), reader.GetDouble(3))
                            });
                        }
                    }
                }
            }

            return list;
        }
开发者ID:A-n-d-r-e-y,项目名称:VISLAB,代码行数:31,代码来源:Analyst.cs


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