我有一个从带有 LINQ 的内部连接表中选择的结果集。我怎样才能将结果集作为数据表返回?
DataProviderDataContext db = new DataProviderDataContext();
IEnumerable<DataRow> asd = (IEnumerable<DataRow>)(from dsa in (from usrAddr in db.T_USER_ADDRESSes join usr in db.T_USERs on usrAddr.USER_ID equals usr.USER_ID where usr.USER_ID == UserID select new { usr.REALNAME, usrAddr.USER_ID, usrAddr.USER_ADDRESS_ID, usrAddr.ADDRESS, usrAddr.TITLE, usrAddr.IS_DELIVERY, usrAddr.IS_INVOICE }).AsEnumerable() select dsa);
DataTable dt = asd.CopyToDataTable<DataRow>();
最好的祝福。