c# - issue in DataGrid when load the items -


i tried load top3 record of table datagrid shows error cannot implicitly convert type 'system.linq.iqueryable' 'string'.the code below wrote

mydatatbasedatacontext mydb = new mydatatbasedatacontext();     var top3 = (from t in mydb.gettable<student>() select t).take(2); grd_8.itemstringformat = top3; 

change var top3 = (from t in mydb.gettable<student>() select t).take(2);

to

list<student> top3 = (from t in mydb.gettable<student>() select t).take(2).tolist(); 

and if grd_8.itemstringformat string have convert yr list string using stringbuilder

but can assign list<student> top3 grid itemssource/datasource


Comments

Popular posts from this blog

All overlapping substrings matching a java regex -

c++ - Using OpenSSL in a multi-threaded application -

php - Deleting/Renaming a locked file -