我正在使用存储过程创建一个临时表并希望在数据集合中返回它:
public static >>data collection<< reportData(int intUserID)
{
SqlConnection con = Sql.getConnection();
try
{
SqlCommand cmd = new SqlCommand();
cmd = new SqlCommand("usp_Get_Results", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@UserID", intUserID);
con.Open();
//put into data collection
//return data collection
}
catch (Exception ex)
{
//Log Error
con.Close();
}
finally
{
con.Close();
}
}
我不知道哪个数据收集最好返回。我可能需要对其进行一些处理,所以我不确定什么是最好的,性能不是主要问题。我在考虑 DataSet 或 DataReader 但不知道是否有更适合或最佳实践的方法。任何帮助深表感谢
使用 .NET 2.0,vstudio 2005。
谢谢