C#中如何建立临时表并插入数据?

C#中如何建立临时表并插入数据?,第1张

DataTable oldDt = GetDataTable()

DataTable newDt = oldDt.Clone() //此处就可以将旧DataTable结构赋给新DataTable

foreach(DataRow oldDr in oldDt.Rows)

{

/***

执行filter.....

*******/

DataRow newDr = newDt.NewRow() //新表创建新行

newDr.ItemArray = oldDr .ItemArray//旧表结构行赋给新表结构行

newDt.ImportRow(oldDr )

}

试试这样

select identity(int) as id,prerec .* into #tmp_prerec_pp from prerec where deptno='JINA000000' and paydate='20100417'

select * from #tmp_prerec_pp


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/bake/11836482.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-19
下一篇2023-05-19

发表评论

登录后才能评论

评论列表(0条)

    保存