how to display empty table to datagrid

Answer Posted / dinesh sharma

DataTable tbl=new DataTable;
DataColumn ID=new
Datacolumn("ID",System.Type.GetType("System.Int"));
DataColumn Name=new
DataColumn("NAME",System.Type.GetType("System.String"));
tbl.Columns.add("ID");
tbl.Columns.Add("NAME");
Datarow dr =null;;
for (int i=0;i<100;i++)
{
dr=tbl.NewRow();
}
datagridview1.datasource=tbl;

Is This Answer Correct ?    14 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between connected and disconnected architecture in ado.net?

587


What is csdl entity framework?

555


What is data relation in ado.net?

517


What we do with the object of ado.net dataset after using it?

523


What is command class in ado.net?

476






What DataReader class do in ADO.NET ?

588


What does datareader object do?

539


What do you know about ado.net's objects?

499


What are the major challenges in accessing data from a database?

535


What is ado control?

525


How to aggregating data across related tables?

550


What is difference in record set and dataset?

535


How do I delete a row from a DataTable?

595


Can we load multiple tables in a dataset?

544


What is sqldatasource?

523