Try Below Code
public void GetData()
{
try
{
cc.con = new SqlConnection(cs.DBCon);
cc.con.Open();
cc.cmd = new SqlCommand("Select RTRIM(Pay_ID),RTRIM(PaymentID) from Procedure order by PaymentID", cc.con);
cc.rdr = cc.cmd.ExecuteReader();
dataGridView1.Rows.Clear();
while (cc.rdr.Read())
{
dataGridView1.Rows.Add(cc.rdr[0], cc.rdr[1], cc.rdr[2]);
}
cc.con.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}