由网友(念你成疾.)分享简介:我想查询数据库,并与结果,我想处理它们。而即时处理它们,其中一些将需要被插入到另一个数据库中。既然不能以开放的SqlDataReader的运行另一个查询(据我所知)。我还想着把数据从SqlDataReader中到一个DataTable,而我处理它。是否有一个内置的方式做到这一点,还是有可以完成同样的想法,另一种解决方案...
我想查询数据库,并与结果,我想处理它们。而即时处理它们,其中一些将需要被插入到另一个数据库中。既然不能以开放的SqlDataReader的运行另一个查询(据我所知)。我还想着把数据从SqlDataReader中到一个DataTable,而我处理它。是否有一个内置的方式做到这一点,还是有可以完成同样的想法,另一种解决方案?
解决方案 SqlDataReader的读卡器= com.ExecuteReader();
数据表DT =新的DataTable();
dt.Load(读卡器);
使用的标准设置了休息和拆除的SqlCommand对象,当然。
I want to query a database and with the results, i want to process them. While im processing them, some of them will need to be inserted into another database. Since i cannot run another query with an open SqlDataReader (that i know of). I was thinking about putting the data from the SqlDataReader into a DataTable while i process it. Is there a built in way to do this or is there another solution that can accomplish the same idea?
解决方案SqlDataReader reader = com.ExecuteReader();
DataTable dt = new DataTable();
dt.Load(reader);
With the rest of the standard set-up and tear-down of SqlCommand objects, of course.
相关推荐
最新文章