Link to home
Start Free TrialLog in
Avatar of vivekj2004
vivekj2004

asked on

C# (in memory table

what is the meaning of these two lines:
DataTable x = new DataTable();
x.Columns.Add("Code", typeof(int));

I mean conceptually what are they doing (especially in a windows applications). I would like special description of pupose of second line.
Avatar of Jini Jose
Jini Jose
Flag of India image

DataTable x = new DataTable(); =  you are creating a table. it is not a database table.

x.Columns.Add("Code", typeof(int)); =  you are adding a column of type int to the table x.


below the code is for adding some values to it

DataRow dr=x.NewRow();
dr["Code"]="1"
dt.Rows.Add(dt)



Avatar of vivekj2004
vivekj2004

ASKER

if there is no second parameter there e.g.,:
 
       x.Columns.Add("val");
 does this mean that the column type will be string?
ASKER CERTIFIED SOLUTION
Avatar of Jini Jose
Jini Jose
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial