Click here to Skip to main content
16,021,125 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello All,
I have created a temporary table through programming.I want to show data of this temporary table into grid view in asp.net.I want that this temporary table will show data from existing table's data.how it will be possible to fill temporary table from existing table in front end.

coding for Temporary table is:---

private DataTable CreateDataTable()
    {
        DataTable myDataTable = new DataTable();

        DataColumn myDataColumn;

        myDataColumn = new DataColumn();
        myDataColumn.DataType = Type.GetType("System.Int32");
        myDataColumn.ColumnName = "id";
        myDataTable.Columns.Add(myDataColumn);

        myDataColumn = new DataColumn();
        myDataColumn.DataType = Type.GetType("System.String");
        myDataColumn.ColumnName = "Req_Name";
        myDataTable.Columns.Add(myDataColumn);

        myDataColumn = new DataColumn();
        myDataColumn.DataType = Type.GetType("System.Int32");
        myDataColumn.ColumnName = "Req_Amt";
        myDataTable.Columns.Add(myDataColumn);

        myDataColumn = new DataColumn();
        myDataColumn.DataType = Type.GetType("System.DateTime");
        myDataColumn.ColumnName = "Req_date";
        myDataTable.Columns.Add(myDataColumn);

          myDataColumn = new DataColumn();
          myDataColumn.DataType = Type.GetType("System.Int32");
        myDataColumn.ColumnName = "Req_head_ID";
        myDataTable.Columns.Add(myDataColumn);

          myDataColumn = new DataColumn();
          myDataColumn.DataType = Type.GetType("System.Int32");
        myDataColumn.ColumnName = "Req_lib_head_id";
        myDataTable.Columns.Add(myDataColumn);

          myDataColumn = new DataColumn();
        myDataColumn.DataType = Type.GetType("System.String");
        myDataColumn.ColumnName = "req_quantity";
        myDataTable.Columns.Add(myDataColumn);
         

        return myDataTable;
    }
Posted
Updated 6-Aug-10 19:35pm
v3

1 solution

Try this.. I have the same situation and i solved by this.
First you have to fill a datatable using appropriate SQL and then copy each row of this datatable to your temp table.
 
Share this answer
 
Comments
NerishaBV1 25-May-11 5:35am    
Where is the solution??

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900