Building a grid defining specific columns and rows from a stored procedure
<p>I have a stored procedure that returns a few columns, I am only interested in building a gridview with the <code>ProjectID</code> values that are null. My code below returns all the rows of all the columns, it is just supposed to return where column = projectID. Can someone take a look at it. Thanks</p>

<pre><code>DataRowCollection rowCollection = spDataTable.Rows;
DataTable dt = new DataTable();

foreach (DataColumn col in spDataTable.Columns)
{
                if (col.ColumnName == "ProjectID")
                {
                    dt.Columns.Add(col.ColumnName);
                    lb_Test.Items.Add(col.ColumnName);
                        foreach(DataRow ros in col.Table.Rows)
                        {
                            foreach (object oObj in ros.ItemArray)
                            {
                                if (oObj != null)
                                {
                                    if (col.ColumnName == "ProjectID")
                                    {
                                        lb_Test.Items.Add(oObj.ToString());
                                        dt.Rows.Add(oObj);
                                    }
                                }
                                else
                                {
                                    lb_Test.Items.Add("Null");
                                }
                            }   
                        }
                        grd_test.DataSource = dt;
                        grd_test.DataBind();
                }
                else
                {
                    lb_Test.Items.Add("Not valid Name");
                }
}
</code></pre>
