Hello again,
I am creating a Datagridview with 3 columns, product_id, product_name and quantity. but in my database i have 4 columns namely prod_id, prod_name, quantity and item_status. What i want to do is , if my item_status is texted "PHASE OUT" or "INACTIVE", i will skip that row while if my item_status is "ACTIVE" i want the full row to be displayed.

How can i achieve that. ty. here is my code so far, only display the datas.

 con.ConnectionString = @"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\justine\documents\visual studio 2013\Projects\Prod2\Prod2\Products.mdf;Integrated Security=True;Connect Timeout=30";
            con.Open();
            SqlDataAdapter sda = new SqlDataAdapter("SELECT prod_id, prod_name, quantity,item_status FROM Table_3", con);
            DataTable dt = new DataTable();
            sda.Fill(dt);
            dataGridViewX1.Rows.Clear();
            foreach (DataRow item in dt.Rows)
            {
                int n = dataGridViewX1.Rows.Add();
                dataGridViewX1.Rows[n].Cells[0].Value = item[0].ToString();
                dataGridViewX1.Rows[n].Cells[1].Value = item[1].ToString();
                dataGridViewX1.Rows[n].Cells[2].Value = item[2].ToString();

                }

ty and sorry for beri bad engirish

Use "Where" clause in SQL Statement.
You can use the followings if you like.

SqlDataAdapter sda = new SqlDataAdapter("SELECT prod_id, prod_name, quantity,item_status FROM Table_3 Where item_status= 'ACTIVE'", con);
Comments
My thoughts exactly
This question has already been answered. Start a new discussion instead.