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


C# System.Data.IDbConnection.QueryMultiple方法代码示例

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


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

示例1: Main


//.........这里部分代码省略.........
            RIGHT OUTER JOIN (SELECT
            CONVERT(VARCHAR(10), DATEADD(dd, number, CONVERT(VARCHAR(8), @start, 120) + '01'), 120) AS date
            FROM master..spt_values
            WHERE type = 'P'
            AND DATEADD(dd, number, CONVERT(VARCHAR(8), @start, 120) + '01') <= @end
            AND DATEADD(dd, number, CONVERT(VARCHAR(8), @start, 120) + '01') >= @start) t5 ON t4.date = t5.date";

            var testSql2 = @"SELECT
            t5.date,
            ISNULL(t1.count, 0) AS SmsSendCount,
            ISNULL(t2.count, 0) AS Hits,
            ISNULL(t3.count, 0) AS Dloaded,
            ISNULL(t4.count, 0) AS Registrations
            FROM

            (SELECT
            CAST(t.CREATED_ON AS DATE) AS date,
            COUNT(t.CREATED_ON) AS count
            FROM dbo.SMS_DETAIL t
            WHERE t.CREATED_ON >= @start
            AND t.CREATED_ON <= DATEADD(DAY, 1, @end)
            and t.SERVICE_DEPT_ID = @deptID
            GROUP BY CAST(t.CREATED_ON AS DATE)) t1
            FULL OUTER JOIN (SELECT
            CAST(t.CREATED_ON AS DATE) AS date,
            COUNT(t.CREATED_ON) AS count
            FROM dbo.SMS_POPULARIZE_TRAFFIC t
            WHERE t.CREATED_ON >= @start
            AND t.CREATED_ON <= DATEADD(DAY, 1, @end)
            and t.SERVICE_DEPT_ID = @deptID
            GROUP BY CAST(t.CREATED_ON AS DATE)) t2 ON t1.date = t2.date
            FULL OUTER JOIN (SELECT
            CAST(t.CREATED_ON AS DATE) AS date,
            COUNT(t.CREATED_ON) AS count
            FROM dbo.SMS_POPULARIZE_DOWNLOADS t
            WHERE t.CREATED_ON >= @start
            AND t.CREATED_ON <= DATEADD(DAY, 1, @end)
            and t.SERVICE_DEPT_ID = @deptID
            GROUP BY CAST(t.CREATED_ON AS DATE)) t3 ON t2.date = t3.date
            FULL OUTER JOIN (SELECT
            CAST(t1.CREATED_ON AS DATE) AS date,
            COUNT(t1.CREATED_ON) AS count
            FROM	dbo.CUSTOMER t1,
                dbo.CUST_SERVICE_INFO t2
            WHERE t1.ID = t2.CUSTOMER_ID
            AND t1.CREATED_ON >= @start
            AND t1.CREATED_ON <= DATEADD(DAY, 1, @end)
            and t2.SERVICE_DEPT_ID = @deptID
            GROUP BY CAST(t1.CREATED_ON AS DATE)) t4 ON t3.date = t4.date
            RIGHT OUTER JOIN (SELECT
            CONVERT(VARCHAR(10), DATEADD(dd, number, CONVERT(VARCHAR(8), @start, 120) + '01'), 120) AS date
            FROM master..spt_values
            WHERE type = 'P'
            AND DATEADD(dd, number, CONVERT(VARCHAR(8), @start, 120) + '01') <= @end
            AND DATEADD(dd, number, CONVERT(VARCHAR(8), @start, 120) + '01') >= @start) t5 ON t4.date = t5.date";

            var items = HZ_Conn.Query<SmsStatisticResultItem>(testSql2, new { start = new DateTime(2016, 5, 1), end = new DateTime(2016, 5, 30), deptID = 4 });

            //Console.ReadLine();

            //var dddd = DC_Conn.Query<DataCenterCustomerInfoModel>(sql_dc,new { deptCodes = new string[] { "bjbr002" },dateStart = new DateTime(2016,2,17),dateEnd = new DateTime(2016,2,18) });

            //Stopwatch timer = new Stopwatch();

            //var testKeys = new int[] { 100,200,500,1000,1500,2000 };

            //foreach(var key in testKeys)
            //{
            //    var mobiles = dddd.Take(key).Select(c => c.Mobilphone);
            //    var sql_hz_mobile = @"select t.MOBILE from CUSTOMER t where t.MOBILE in @mobile";

            //    timer.Start();

            //    var ddddddd = HZ_Conn.Query<string>(sql_hz_mobile,new { mobile = mobiles });

            //    timer.Stop();

            //    var second = timer.Elapsed.TotalSeconds;
            //    Trace.WriteLine(string.Format("{1} phones Execution time was {0:F1} s.",second,key));
            //}

            //Console.ReadLine();

            //var query1 = HZ_Conn.QueryMultiple(testsql,new { deptID = 4 });
            //var count1 = query1.Read<int>();
            //var count2 = query1.Read<int>();

            var exams = HZ_Conn.Query<RptExam>(examSQL, new { checkUnitCode = "bjbr002", workNo = "0000068516" });
            var exam = exams.FirstOrDefault();
            if (exam != null)
            {
                using (var query = HZ_Conn.QueryMultiple(sql, new { examID = exams.FirstOrDefault().Id }))
                {
                    var chechItems = query.Read<RptCheckItem>().ToList();
                    var checkResults = query.Read<RptCheckResult>().ToList();
                    var summarys = query.Read<RptSummary>().ToList();
                    var labels = query.Read<int>().ToList();
                }
            }
        }
开发者ID:laball,项目名称:demo,代码行数:101,代码来源:Program.cs


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