c# - String formatting using LINQ2SQL -
i have textbox (which shows notes). user selects his/her name , add note. want show note in right hand side of page can review his/her , past notes. table contains these items:
memo
datecreated
user
this code here:
var showmemo = r in em.entitymemovs_1s r.entityid == getentity select r.memo; var showuser = r in em.entitymemovs_1s r.entityid == getentity select r.user; tbshownote.text = string.join(environment.newline, showmemo); tbshownote.text += string.join(environment.newline, showuser);
this showing me notes in fashion:
test1 test2 test3 user1 user2 user3
i dont want way...i want this:
5/5/2011: first note. -user1
5/6/2011: second note. -user2
how should achieve this? thanks!
well, if want inline, do:
var notes = r in em.entitymemovs_1s r.entityid == getentity select r.createddate.toshortdatestring() + ": " + r.memo + " - " + r.user; txtshownote.text = string.join("<br/>", notes);
essentially, create string in linq query 1 statement, , if posting web, use <br/>
instead of new lines.
hth.
Comments
Post a Comment