自定义DateTable样例
程序员文章站
2022-03-20 13:58:03
...
[size=large][color=green]记录流程备查[/color][/size]
#region 创建自定义DataTable
DataTable dt = new DataTable("downQuestion");
DataColumn dcQuestionID = new DataColumn("QuestionID",typeof(int));
DataColumn dcContentType = new DataColumn("ContentType",typeof(string));
DataColumn dcCompanyName = new DataColumn("CompanyName",typeof(string));
DataColumn dcQuestionContent = new DataColumn("QuestionContent",typeof(string));
DataColumn dcCreateTime = new DataColumn("CreateTime", typeof(DateTime));
DataColumn dcIsDisplay = new DataColumn("IsDisplay", typeof(bool));
DataColumn dcIsReply = new DataColumn("IsReply", typeof(bool));
DataColumn dcQuestionUserName = new DataColumn("QuestionUserName", typeof(string));
DataColumn dcQuestionRealname = new DataColumn("Realname", typeof(string));
DataColumn dcAnswerUserName = new DataColumn("AnswerUserName", typeof(string));
dt.Columns.Add(dcQuestionID);
dt.Columns.Add(dcContentType);
dt.Columns.Add(dcCompanyName);
dt.Columns.Add(dcQuestionContent);
dt.Columns.Add(dcCreateTime);
dt.Columns.Add(dcIsDisplay);
dt.Columns.Add(dcIsReply);
dt.Columns.Add(dcQuestionUserName);
dt.Columns.Add(dcQuestionRealname);
dt.Columns.Add(dcAnswerUserName);
#endregion
#region 循环填入数据
for (int i = 0; i < questionTable.Rows.Count;i++ )
{
//问题
DataRow qdr = dt.NewRow();
qdr["QuestionID"] = questionTable.Rows[i]["ID"];
qdr["ContentType"] = questionTable.Rows[i]["ContentType"];
qdr["CompanyName"] = questionTable.Rows[i]["CompanyName"];
qdr["QuestionContent"] = questionTable.Rows[i]["QuestionContent"];
qdr["CreateTime"] = questionTable.Rows[i]["CreateTime"];
qdr["IsDisplay"] = questionTable.Rows[i]["IsDisplay"];
qdr["IsReply"] = questionTable.Rows[i]["IsReply"];
qdr["QuestionUserName"] = questionTable.Rows[i]["UserName"];
qdr["Realname"] = questionTable.Rows[i]["Realname"];
//qdr["AnswerUserName"] = questionTable.Rows[i]["AnswerUserName"];
dt.Rows.Add(qdr);
}
#endregion
上一篇: 通过url下载文件HttpURLConnection
下一篇: 数字金额转成大写中文金额
推荐阅读
-
LOJ#515. 「LibreOJ β Round #2」贪心只能过样例(bitset)
-
Debug卡原理及其使用样例介绍
-
spring-boot-2.0.3不一样系列之番外篇 - 自定义session管理,绝对有值得你看的地方
-
Angular实现模版驱动表单的自定义校验功能(密码确认为例)
-
Log4net保存自定义字段到数据库(以oracle为例)
-
第一节:.Net版基于WebSocket的聊天室样例
-
【Android】用Cubism 2制作自己的Live2D——官方App样例源码学习(1)!
-
Keras入门--Mnist手写数字识别(源自Keras官方样例)
-
PowerPoint中如何制作自定义动画以落叶动画制作为例
-
Java和.Net版通用工具类实现--生成自定义Web Html/Excel测试用例和测试报告