string constr = @"Data Source=(localdb)MSSQLLocalDB;Initial Catalog=Test;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False"; private void Form1_Load(object sender, EventArgs e) { dataGridView1.Columns["Column4"].DefaultCellStyle.Format = "N2"; using (SqlConnection conn = new SqlConnection(constr)) { SqlDataAdapter sda = new SqlDataAdapter("Select * From Car", conn); DataSet Ds = new DataSet(); sda.Fill(Ds, "T_Class"); foreach (DataRow row in Ds.Tables[0].Rows) { int index = dataGridView1.Rows.Add(); dataGridView1.Rows[index].Cells["Column1"].Value = row["Id"]; dataGridView1.Rows[index].Cells["Column2"].Value = row["Model"]; dataGridView1.Rows[index].Cells["Column3"].Value = row["Price"]; dataGridView1.Rows[index].Cells["Column4"].Value = row["Code"]; } } }