Loop Through Results from a Method
<p>I have a method that calls a Proc ad returns the data. But I want to call the method and loop through all the results and use the results to plug into an Excel document. I can't seem to figure out how to loop through results coming from the method call. This is my method:</p>

<pre><code>    public DataView GetCoupons()
    {
        string connStr = ConfigurationManager.ConnectionStrings["SiteSqlServer"].ConnectionString;
        SqlConnection conn = new SqlConnection(connStr);
        SqlCommand cmd = new SqlCommand("CPC_GetAllCoupons", conn);
        cmd.CommandType = CommandType.StoredProcedure;

        //make the dap &amp; ds
        SqlDataAdapter dap = new System.Data.SqlClient.SqlDataAdapter(cmd);
        DataSet ds = new DataSet();

        //open con
        if (conn.State == ConnectionState.Closed)
            conn.Open();

        //get the data
        dap.Fill(ds);

        //close the conn and return
        if (conn.State == ConnectionState.Open)
            conn.Close();

        return ds.Tables[0].DefaultView;
   }
</code></pre>

<p>So I want to call that method and get all the results and loop through the results. How would I go about doing that?</p>

<p>Thanks!</p>
