asp.net datareader

时间:2013-02-09 08:39:37

标签: asp.net dataset dataadapter

我需要使用DataSet ad DataAdapter和下面的代码,但我无法集成它。你能不能帮我添加数据集和dataadapter。

DbCommand dbCommand10;
dbCommand10 = db.GetStoredProcCommand("Select_Post_Comment");
db.AddInParameter(dbCommand10, "PostId", DbType.Guid, Post_ID);
//IDataReader dr10 = db.ExecuteReader(dbCommand10);

1 个答案:

答案 0 :(得分:0)

// 1. setup command

// 2. add parameters

// 3. pass instance of command to data adapter
var da = new SqlDataAdapter( command );

// 4. create and fill a dataset (executes the command passed to the adapter)
var ds = new DataSet();
da.Fill( ds );

// 5. be sure to dispose command/connection
相关问题