none
static datatable question RRS feed

  • Question

  •  

     

     

    hello can anyone show me how to create a static datatable and add columns into it...

     

    here's my sample class..

    Code Snippet

     

    public class SampleClass

    {

     

    public static DataTable StaticTable = new DataTable();

    }

     

     

     

     

    thanks! Smile

    Thursday, September 20, 2007 1:26 AM

Answers

  • Hi 

     

      you can create static method to create table as like

     

    public static datatable  createtable()

    {

     

      datatable table1=new datatable();

    table1.columns.add("ID",TYPEOF(INT));

    table1.columns.add("name",typeof(string));

     

     return table1;

     

    }

     

    Regards

    k.palan

    Thursday, September 20, 2007 3:30 AM

All replies

  • Hi 

     

      you can create static method to create table as like

     

    public static datatable  createtable()

    {

     

      datatable table1=new datatable();

    table1.columns.add("ID",TYPEOF(INT));

    table1.columns.add("name",typeof(string));

     

     return table1;

     

    }

     

    Regards

    k.palan

    Thursday, September 20, 2007 3:30 AM
  •  

    alright! thanks a lot man! Smile
    Thursday, September 20, 2007 4:03 AM