asp.net - Local sequence cannot be used in LINQ to SQL implementations -
so here trying do. have tables db , 1 list of member. member asp.net membership controls , combined membership , profile object. have function return list following mems object:
public property firstname string = "" public property lastname string = "" public property address1 string = "" public property address2 string = "" public property city string = "" public property state system.int32 = "0" public property zip string = "" public property title string = "" public property phone system.decimal = "0" public property id system.int32 = "0" public property usertype system.int32 = "0" public property ssn system.int32 = "0" public property email string = "" public property username string = "" public property islockedout boolean = false private loaded boolean = false
then have 2 tables of jobs , accounts:
jobs
jobid numeric(18,0) accountid numeric(18,0) name varchar(50) frequency int modifier varchar(90) active bit sdate date edate date
accounts
accountid numeric(18,0) companyid numeric(18,0) contactid varchar(256) type int name varchar(256) address1 varchar(50) address2 varchar(50) city varchar(50) state int zip varchar(5) authcode varchar(10) comments text
the output trying achieve list of jobs accounts particular companyid info mems. have working elsewhere accounts, when throw jobs in mix, give me error of:
local sequence cannot used in linq sql implementations of query operators except contains operator.
here have gotten function of moment:
<system.web.services.webmethod(enablesession:=true)> _ public shared function jobsearch(json string) string dim damnser new javascriptserializer dim search searchstring = damnser.deserialize(of searchstring)(json) dim mydb new mydbdatacontext dim pro new mems(httpcontext.current.user.identity.name) dim acc = in mydb.accounts a.companyid = pro.id select dim acclist = acc.where(function(r) r.accountid).[select](function(r) r.accountid.tostring()).toarray() dim q = u in util.getmems join in acc on a.contactid equals u.username u.firstname.tolower.contains(search.firstname.tolower) , u.lastname.tolower.contains(search.lastname.tolower) , a.name.tolower.contains(search.name.tolower) , a.contactid.tolower.contains(search.email.tolower) , u.phone.tostring.contains(search.phone.tolower) , a.accountid.tostring.contains(search.accountid.tolower) select new {.firstname = u.firstname, .lastname = u.lastname, .name = a.name, .email = u.email, .phone = u.phone, .accountid = a.accountid, .city = a.city, .state = (from s in mydb.states s.stateid = a.state select s.stateabbr).single } 'this line added between have working , new section , error happens dim qq = j in mydb.jobs acclist.contains(j.accountid) select new {j.jobid, j.name, (from z in q z.accountid = j.accountid).single} return damnser.serialize(qq) end function
i decided go different route it
<system.web.services.webmethod(enablesession:=true)> _ public shared function jobsearch(json string) string dim damnser new javascriptserializer dim search searchstring = damnser.deserialize(of searchstring)(json) dim mydb new mydbdatacontext dim pro new mems(httpcontext.current.user.identity.name) dim acc = in mydb.accounts a.companyid = pro.id select dim q = u in util.getmems join in acc on a.contactid equals u.username u.firstname.tolower.contains(search.firstname.tolower) , u.lastname.tolower.contains(search.lastname.tolower) , a.name.tolower.contains(search.name.tolower) , a.contactid.tolower.contains(search.email.tolower) , u.phone.tostring.contains(search.phone.tolower) , a.accountid.tostring.contains(search.accountid.tolower) select new {.firstname = u.firstname, .lastname = u.lastname, .name = a.name, .email = u.email, .phone = u.phone, .accountid = a.accountid, .city = a.city, .state = (from s in mydb.states s.stateid = a.state select s.stateabbr).single, .zip = a.zip, .locations = (from l in mydb.locations l.accountid = a.accountid select new {l.accountid, l.address1, l.address2, l.city, l.comments, l.locationid, .state = (from s in mydb.states s.stateid = l.state select s.stateabbr).single, l.zip, .jobcount = (from j in mydb.jobs j.locationid = l.locationid select j).count} ) } return damnser.serialize(q) end function
Comments
Post a Comment