Solved

C# (in memory table

Posted on 2010-08-21
3
551 Views
Last Modified: 2013-12-17
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.
0
Comment
Question by:vivekj2004
  • 2
3 Comments
 
LVL 10

Expert Comment

by:Jini Jose
ID: 33491709
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)



0
 

Author Comment

by:vivekj2004
ID: 33491873
if there is no second parameter there e.g.,:
 
       x.Columns.Add("val");
 does this mean that the column type will be string?
0
 
LVL 10

Accepted Solution

by:
Jini Jose earned 500 total points
ID: 33491876
yes, by deafult the column type should be string.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
User Beware!  This is a rather permanent solution to removing your email from an exchange server.  The only way to truly go back is to have your exchange administrator restore your mailbox from backups.  This is usually the option of last resort.  A…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question