C# LinQ-检索列名和值

C# LinQ-检索列名和值,c#,sql,sql-server,linq,stored-procedures,C#,Sql,Sql Server,Linq,Stored Procedures,我创建了一个方法,该方法调用一个检索大量列的存储过程。我正在尝试获取每个列的名称/值,并将其放入字典中 我使用SqlDataReader进行操作,非常简单: for (int i = 0; i < sqlDataReader.FieldCount; i++) { user.Attributes.Add(sqlDataReader.GetName(i), sqlDataReader.GetValue(i)); } 有什么帮助吗 提前感谢。您是否尝试映射存储过程?是的,但我需

我创建了一个方法,该方法调用一个检索大量列的存储过程。我正在尝试获取每个列的名称/值,并将其放入字典中

我使用SqlDataReader进行操作,非常简单:

for (int i = 0; i < sqlDataReader.FieldCount; i++)
{
    user.Attributes.Add(sqlDataReader.GetName(i),
    sqlDataReader.GetValue(i));
}
有什么帮助吗


提前感谢。

您是否尝试映射存储过程?是的,但我需要动态获取列名称。
[global::System.Data.Linq.Mapping.FunctionAttribute(Name = "dbo.myProc")]
public Dictionary<string, object> LoadUsersList(int campId, int selectionId, string threadGUID)
{
    // How to turn it in a Dictionary containing Key ( Column Name ) - 
    //Value ( Column Value )? Can i do without use partial class?
    this.ExecuteQuery<System.Collections.IEnumerable>
             (String.Format("EXEC dbo.myProc @BusinessId = {0}, @UserId = {1}",
                 businessId, userId)); 
    return null;
}