i need to add a column in gridview..
the column should contain image of the person..and the name of the image is to be taken from database.

columns: Picture:ee.jpg
Address:"abc street"

the picture ee.jpg is saved in a folder "Images" in the Website.

could someone help me...to find a solution for this... please..

if you want to add unbound columns in datagridview please check this this contains a complete example. And if you want to add columns and rows from dataset then try following code

conString = "Data Source=(local);Initial Catalog=Northwind;Integrated Security=True";
            con = new SqlConnection(conString);
            string quryString = " select * from Employees";
            da = new SqlDataAdapter(quryString, con);
            ds = new DataSet();
            da.Fill(ds, "Emp");

if you want to add rows by using datasource method try this

dataGridView1.DataSource = ds.Tables["Emp"];

and if you want to add row by row data in datagridview try the following code

dataGridView1.Columns.Add("EmpID", "ID");
            dataGridView1.Columns.Add("FirstName", "FirstName");
            dataGridView1.Columns.Add("LastName", "LastName");
            int row = ds.Tables["Emp"].Rows.Count - 1;
            for (int r = 0; r<= row; r++)
                dataGridView1.Rows[r].Cells[0].Value = ds.Tables["Emp"].Rows[r].ItemArray[0];
                dataGridView1.Rows[r].Cells[1].Value = ds.Tables["Emp"].Rows[r].ItemArray[1];
                dataGridView1.Rows[r].Cells[2].Value = ds.Tables["Emp"].Rows[r].ItemArray[2];
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.