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

Why edit is not possible in repeater?

520


Describe the command object and its method.

522


Explain the architecture of ado.net?

539


What is command class in ado.net?

473


What are the usages of the command object in ado.net?

548






Explain the difference between data reader and data set?

483


What are the different namespaces used in the project to connect the database? What data providers available in .net to connect to database?

771


What is difference between datatable and dataset?

522


Which is better ole db or odbc?

496


What is the difference between ado.net and entity framework?

504


Explain how to find the given query is optimised one or not?

513


What is ole data type?

503


How to store data in memory?

506


Which database is the ado.net?

496


What are the disadvantages of using datalist?

505