Logo 
Search:

Asp.net Answers

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds
  Question Asked By: Clifford Chapman   on Aug 27 In Asp.net Category.

  
Question Answered By: Murad Bashara   on Aug 27


public void RunProc(string procName, out SqlDataReader dataReader)
{
SqlCommand cmd = CreateCommand(procName, null);
dataReader = cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection);
}

public SqlDataReader GetList(string prodid)
{
SqlDataReader dataReader = null;
try
{
// create data  object and params
Database data = new Database();
SqlParameter[] prams = { data.MakeInParam("@prodid", SqlDbType.VarChar, 30,
prodid) };

// run the stored procedure
data.RunProc("Get_List_sp", prams, out dataReader);
}
catch (Exception ex)
{
Error.Log(ex.ToString());
}

return dataReader;
}dataReader;
}

SqlDataReader reader = null;
string prodid = Request.QueryString["product_id"];
reader = GetList(prodid);
..... bind controls

Share: 

 

This Question has 3 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on dataset vs. datareader Or get search suggestion and latest updates.


Tagged: