把List<string>转为DataTable
//把List<string>转为DataTable
List<string> myList = new List<string>();
DataTable dt2 = new DataTable();
dt2.Columns.Add(new DataColumn("sqlString", typeof(string))); //给表dt2添加字段
DataRow dr;
foreach (var i in myList)
{
dr = dt2.NewRow(); //字段对象
dr["sqlString"] = i; //赋值
dt2.Rows.Add(dr); //添加给表
}
把List<string>转为DataTable的更多相关文章
- .NET(C#)中的DataSet、string、DataTable等对象转换成Json
ConvertJson.cs类 using System; using System.Collections.Generic; using System.Text; using System.Data ...
- (C#)中的DataSet、string、DataTable等对象转换成Json
ConvertJson.cs类 using System; using System.Collections.Generic; using System.Text; using System.Data ...
- .net 打开Excel文档并转为DataTable
/// <summary> /// 打开Excel文档并转为DataTable /// </summary> /// <returns></returns&g ...
- DataTable.Select筛选过滤数据返回DataRow[]转为DataTable添加到DataSet
问题还原,如图所示,我们要筛选所有SHDP 为北京翠微KR的数据. 1. 筛选DataTable微软为我们提供了一个方法DataTable.Select(),其用法如下: 1) Select()—— ...
- [C#]List<int>转string[],string[]转为string
// List<int>转string[] public string[] ListInt2StringArray(List<int> input) { return Arra ...
- C#中的DataSet、string、DataTable、对象转换成Json的实现代码
C#中对象,字符串,dataTable.DataReader.DataSet,对象集合转换成Json字符串方法. public class ConvertJson { #region 私有方法 /// ...
- {}typeof string转为 obj json
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/1.11.3/jquer ...
- 读取Excel里面的内容转为DataTable
using System; using System.Collections.Generic; using System.Data; using System.Data.OleDb; using Sy ...
- C++ MFC std::string转为 std::wstring
std::string转为 std::wstring std::wstring UTF8_To_UTF16(const std::string& source) { unsigned long ...
随机推荐
- Java设计模式百例 - 观察者模式
观察者(Observer)模式定义了一种一对多的依赖关系,让多个观察者对象同时监听某一个主题对象,主体对象的状态变化会通知所有观察者对象.观察者模式又叫做发布-订阅(Publish/Subscribe ...
- MbrFix 问题
删除Windows/Linux双系统下的Linux系统 参考博客 注意:官网上的 MbrFix.exe 下载或许太慢. CSDN下载 问题 1.看到博客下面的评论写道: 为什么我的到第四步的时候会提示 ...
- ubuntu 设置plank开机自启之后关机键失效变为注销键
之前因为猎奇心,给我的ubuntu系统换了一个macUbuntu的桌面,但是之前用的dock是docky,昨日闲来无聊换成了plank,设置成然后就发现我的系统关不了机了,只能通过指令关机. 百度之后 ...
- Elasticsearch安装 + Head插件安装 + Bigdesk插件安装
一.Elasticsearch安装 1.官网下载zip包:https://www.elastic.co/downloads/elasticsearch 2.解压到自己指定的文件夹 3.运行\bin\e ...
- 小而实用的工具插件集锦(JQGrid,zTree)
jqgrid,JQGrid是一个在jquery基础上做的一个表格控件,看起来感觉还可以,以ajax的方式和服务器端通信 效果图: 这个小东西,多用在在工作流上面. 中文文档: http://blog. ...
- 关于ip层的作用网址链接
http://rabbit.xttc.edu.cn/rabbit/htm/artical/201091113054.shtml
- 动态可缓存的内容管理系统(CMS)
摘要:内容管理系统(CMS)在各大商业站点和门户站点中扮演着重要的角色,是内容有效组织和快速发布极为重要的基础平台.目前主流的内容发布系统都使用静态页面进行内容发布,在我们的实际使用过程中我们深切的感 ...
- 积累 ---- PHP可能会遇到的面试题
1.白盒测试和黑盒测试的区别 2.Bootstrap是什么 3.OOP是什么意思 4.git和svn的使用 5.常用的git命令 6.lamp开发环境 7.高内聚,低耦合
- PHP数组排序和按数量分割
用PHP自带array_multisort函数排序 <?php $data = array(); $data[] = array('volume' => 67, 'editi ...
- B/S与C/S的区别
参考:http://www.cnblogs.com/groler/articles/2116905.html 一.概念 C/S结构:即Client/Server(客户机/服务器)结构,是大家熟知的软件 ...