DataSet and stored procedures

  • Thread starter Thread starter Saso Zagoranski
  • Start date Start date
S

Saso Zagoranski

Hi!

Perhaps I should ask this at the sqlserver newsgroup but I'll try my luck
here, anyway :)

I have a stored procedure, which runs a select statement... then does a
search through the results
and return those, which match a special search criteria.
My questions are:
1 .How do I return a Dataset class (or something similar) from the stored
procedure?
2. How do I call the stored procedure? Up to now I have always used
SqlDataAdapter.Fill(dataset)

Any help is appreciated,
saso
 
Try de following

SqlDataReader dr = null;

bool ret= true;

SqlParameter param = null;

SqlCommand cmd = new SqlCommand();

cmd.Connection = m_cn;

cmd.CommandType = CommandType.StoredProcedure;

cmd.CommandText = "StoredProcName";

param = new SqlParameter("@Parameter", SqlDbType.VarChar, 200);

param.Value = DBNull.Value;

cmd.Parameters.Add(param);

dr = cmd.ExecuteReader();



And your set

Kevin Moore
 
Back
Top