Solved

C# (in memory table

Posted on 2010-08-21
3
540 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
Comment Utility
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
Comment Utility
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
Comment Utility
yes, by deafult the column type should be string.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
This very simple solution applies to a narrow cross-section of the "needs to close" variety. In this case, the full message in Event Viewer was in applog, Event ID 1000: Faulting application iexplore.exe, version 8.0.6001.18702, faulting module …
Viewers will learn how to maximize accessibility options in an Excel workbook for users with accessibility issues.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

744 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

17 Experts available now in Live!

Get 1:1 Help Now