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


C# OleDbCommand.GetInt32方法代码示例

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


在下文中一共展示了OleDbCommand.GetInt32方法的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: caricaDaDb

        void caricaDaDb()
        {
            string sconn;
            sconn = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=db.mdb";
            OleDbConnection conn = new OleDbConnection(sconn);

            try
            {
                conn.Open();

                N_NODI = getint32("SELECT valore FROM parametri WHERE parametro='n' ", 0, conn);
                settaNnodi(N_NODI);
                m = getint32("SELECT valore FROM parametri WHERE parametro='m' ", 0, conn);

                //leggo nodi
                OleDbDataReader myreader = new OleDbCommand("select x,y,nome from nodi", conn).ExecuteReader();

                for (int i = 0; i < N_NODI; i++)
                {
                    nodi[i].x = nodi[i].y = 0;
                    archi[i] = new ArrayList();
                    d[i] = new ArrayList();

                }

                while (myreader.Read())
                {
                    int x;
                    int y;
                    int nome;
                    //int a, b, c;
                    //myreader.Read();

                    x = myreader.GetInt32(0);
                    y = myreader.GetInt32(1);
                    nome = Convert.ToInt32(myreader.GetString(2));

                    nodi[nome].x = x;
                    nodi[nome].y = y;
                    nodi[nome].name = Convert.ToString(nome);

                    archi[nome] = new ArrayList();
                    d[nome] = new ArrayList();
                }

                //leggo archi
                myreader = new OleDbCommand("select x,y,dist from archi", conn).ExecuteReader();
                //for (int j = 0; j < m; j++) // per ogni arco...
                while (myreader.Read())
                {
                    int from;
                    int dest;
                    int dist;

                    //myreader.Read();

                    from = myreader.GetInt32(0);
                    dest = myreader.GetInt32(1);
                    dist = myreader.GetInt32(2);

                    //aggiungo arco
                    if (archi[from] == null)
                        archi[from] = new ArrayList();

                    if (d[from] == null)
                        d[from] = new ArrayList();

                    archi[from].Add(dest);
                    d[from].Add(dist);

                }

                DrawGraph();

                conn.Close();

            }
            catch (OleDbException e)
            {
                MessageBox.Show("Errore DB" + e.Message);
            }
        }
开发者ID:elvisciotti,项目名称:opengl-vs-dot-net-graphics,代码行数:82,代码来源:load-save.cs

示例3: getint32

 int getint32(String query, int num_colonn, OleDbConnection conn)
 {
     OleDbDataReader myreader = new OleDbCommand(query, conn).ExecuteReader();
     myreader.Read();
     return myreader.GetInt32(num_colonn);
 }
开发者ID:elvisciotti,项目名称:opengl-vs-dot-net-graphics,代码行数:6,代码来源:load-save.cs


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