I am getting this error
Unable to cast object of type 'System.Collections.Generic.List`1[TransTripLeg]' to type 'System.Data.DataTable'.
and I can't seem to figure out how to resolve it. The error occurs at DataTable dtTable =
in the code below.
if (!string.IsNullOrEmpty(Request.QueryString["EditMode"]))
{
DataTable dtUpdate = (DataTable)Session["TripRecords"];
DataRow[] customerRow = dtUpdate.Select("LegID = '" + sLegID.ToString() + "'");
I think I am casting it to type DataTable, but then I still get the error.
You need to cast Session["TripRecords"]
to List<TransTripLeg>
instead of DataTable
var collection = (List<TransTripLeg>)Session["TripRecords"];
var legs = collection.Where(c => c.LegID == sLegID);
删除该符号仅对我有效(')对我有效
DataRow[] dr = allleaveDt.Select("EmployeeId=" + empId);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.