Hi,
try below code.
con.Open();
string sql = "insert into tasks values('" + txtT_id.Text + "','" + txtname.Text + "','" + prir_txtbx.Text + "','" + stat_txtbx.Text + "','" + txtcomments.Text + "','" + dtpdue_date.Text + "','" + dtpcompletiondate + "');";
sql += "SELECT * FROM tasks";
SqlCommand cmd = new SqlCommand(sql, con);
cmd.CommandType = CommandType.Text;
DataSet _objDataSet = new DataSet();
SqlDataAdapter _objSqlDataAdapter = new SqlDataAdapter();
cmd.CommandText = sql;
_objSqlDataAdapter.SelectCommand = _objSQLCommand;
_objSqlDataAdapter.Fill(_objDataSet);
dataGridView1.DataSource = _objDataSet.Table[0];
con.Close();
hope it helps