c# - get value Session -
c# - get value Session -
dataclassesdatacontext dc = new dataclassesdatacontext(); var summaryfielddb = b in dc.propertycompanies (b.summaryfield.contains(txtsearch)) select b; session["summaryfield"] = summaryfielddb;
now how can access field summaryfileddb???
if utilize
system.data.linq.table<propertycompany> result = (system.data.linq.table<propertycompany>)session["summaryfield"]; this line when run programme error:unable cast object of type 'system.data.linq.dataquery1[propertycompany]' type 'system.data.linq.table1[propertycompany]
if utilize store procedure fullsearch
session["search"] = dc.fullsearch("anv", true, true, true, true, true, true, true, true, true, true, true); system.data.linq.isingleresult<fullsearchresult> b = (system.data.linq.isingleresult<fullsearchresult>)session["search"]; foreach(var item in b) { //work fields } this work fine!!!
but not want work stored procedure
i query isn't table. imo, should settle on list<t> here:
session["summaryfield"] = summaryfielddb.tolist(); and
var result = (list<propertycompany>)session["summaryfield"]; c# .net asp.net linq session
Comments
Post a Comment