zoukankan      html  css  js  c++  java
  • 获取SqlDataReader的列名

              SqlConnection thisConnection = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"].ToString());
                // Open connection
                thisConnection.Open();
                // Create command for this connection
                SqlCommand thisCommand = thisConnection.CreateCommand();
                // Specify SQL query for this command
                thisCommand.CommandText = sCommandText;
                // Execute DataReader for specified command
                SqlDataReader thisReader = thisCommand.ExecuteReader();
                // While there are rows to read
                //

                //
                View_LogDetailEntity = new List<CView_LogDetail>();//初始化集合

     string sColumnName = string.Empty;

      while (thisReader.Read())
                {
                    CView_LogDetail myCView_LogDetail = new CView_LogDetail();
                    for (int i = 0; i < thisReader.FieldCount; i++)
                    {

                          sColumnName = thisReader.GetName(i).Trim();

                    }

               }

  • 相关阅读:
    Java笔记(十六)……内部类
    pmm系列~基础函数
    redis基础篇~性能问题
    redis基础篇~big-key
    mysql基础~经典题目二
    (转)STORM启动与部署TOPOLOGY
    (转)项目经理怎么当
    专注力的一点体会
    163源报错Hash Sum mismatch 解决方法
    mapreduce.framework.name
  • 原文地址:https://www.cnblogs.com/zhwl/p/1991410.html
Copyright © 2011-2022 走看看