Let factorize your question into two parts
1) Display data from database into datagridview in C#
Read this article
How to populate DataGridView, GridView with SQL statement in C#[
^]
2) Populate textboxes depend upon selected row in datagridview in C#.
private void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
textBox1.Text = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString();
}
Hope this helps if yes then accept and vote the answer otherwise revert back with your queries
--Rahul D.