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

Popular posts from this blog

java - How to pass parameters between Request-Scoped Controllers? -

string - what is the difference between "some" == "some\0" and strcmp("some","some\0") in c++? -

actionscript 3 - Flex: moving a point with rotation doesnt change the point XY? -