Solved

C# (in memory table

Posted on 2010-08-21
3
541 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

The canonical version of this article is on my web site here: http://iconoun.com/articles/collisions/ A companion presentation is available here: http://iconoun.com/articles/collisions/Unicode_Presentation.pdf
Lync meeting or Lync conferencing is what many organizations would like to deploy to allow them save money. But companies are now giving up for various reasons, one of which is that they cannot join external meetings (non-federated company meetings)…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
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…

919 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now