获取SqlDataReader的列名
获取 列名
2023-09-11 14:14:14 时间
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(); } }
相关文章
- [MAC OS] NSButton tag 获取
- C#反射实例应用--------获取程序集信息和通过类名创建类实例
- 微信小程序开发(十)获取手机的经纬度
- linux获取系统启动时间
- 获取mongo 数据大小及collection大小
- form enctype:"multipart/form-data",method:"post" 提交表单,后台获取不到数据
- Leetcode0380. O(1) 时间插入、删除和获取随机元素(medium)
- Java基础--通过反射获取私有的成员方法示例代码
- Atitit.获取某个服务 网络邻居列表 解决方案
- Controller层使用@value注解获取不到properties属性值
- _00019 Storm架构介绍和Storm获取案例(简单的官方网站Java案例)
- python : itertools 中的 islice : 获取迭代器结果的切片,消耗迭代器
- Oracle 和 AWS Redshift 获取 数据库所有表名和列名的