Hello,
First you must create your Columns in the DataGridView like this:
DataGridViewTextBoxColumn cName = new DataGridViewTextBoxColumn();
cName.HeaderText = "Name";
DataGridViewTextBoxColumn cAdress = new DataGridViewTextBoxColumn();
cAdress.HeaderText = "Adress";
DataGridViewTextBoxColumn cPhone = new DataGridViewTextBoxColumn();
cPhone.HeaderText = "Phone";
DataGridViewTextBoxColumn cEMail = new DataGridViewTextBoxColumn();
cEMail.HeaderText = "EMail";
DataGridViewLinkColumn cURL = new DataGridViewLinkColumn();
cURL.HeaderText = "URL";
dataGridView1.Columns.Add(cName);
dataGridView1.Columns.Add(cAdress);
dataGridView1.Columns.Add(cPhone);
dataGridView1.Columns.Add(cEMail);
dataGridView1.Columns.Add(cURL);
You can also create your Columns in the Designer.
Next step you read your DB into a DatSet and read each record of the DataSet.
You can add the Values like this:
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
dataGridView1.Rows.Add(ds.Tables[0].Rows[i]["Name"].ToString(),
ds.Tables[0].Rows[i]["Adress"].ToString(),
ds.Tables[0].Rows[i]["Phone"].ToString(),
ds.Tables[0].Rows[i]["EMail"].ToString(),
ds.Tables[0].Rows[i]["URL"].ToString());
}