文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>获取SqlDataReader的列名

获取SqlDataReader的列名

时间:2011-03-22  来源:郑文亮

          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();

                }

           }

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载