ストアド プロシージャを使用して一時テーブルを作成し、それをデータ コレクションで返したいと考えています。
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 を使用。
ありがとう