c# - LinQ - Retrieve column names and values -
i've created method call stored procedure retrieves lot of columns. i'm trying each column name/value , put in dictionary.
i doing using sqldatareader
, easy:
for (int = 0; < sqldatareader.fieldcount; i++) { user.attributes.add(sqldatareader.getname(i), sqldatareader.getvalue(i)); }
now need change use linq, call stored procedure , return object user.attributes
filled results database.
i'm stuck in how create method retrieves values using linq , how create partial class (can using dictionary?).
here i've done:
[global::system.data.linq.mapping.functionattribute(name = "dbo.myproc")] public dictionary<string, object> loaduserslist(int campid, int selectionid, string threadguid) { // how turn in dictionary containing key ( column name ) - //value ( column value )? can without use partial class? this.executequery<system.collections.ienumerable> (string.format("exec dbo.myproc @businessid = {0}, @userid = {1}", businessid, userid)); return null; }
any help?
thank in advance.
Comments
Post a Comment