473,406 Members | 2,894 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

DataTable columns collection

An attempt to create a stand-alone DataTable returns unexpected errors.

Using this bit of code - lifted from MSDN:

DataTable dt = new DataTable("Customers");

I get the following error: "No overload for method 'DataTable' takes
'1' arguments"

So, I remove the parameter and the compiler makes it as far as:

DataColumn dc = dt.Columns.Add("CustID", typeof(Int32));

At that point I get this error: "DataTable' does not contain a
definition for 'Columns'"

Sure enough, intellisense shows no "Columns" collection for the
DataTable class.
This appears contrary to documentation. Am I missing something?

Thanks
Dan

Nov 13 '06 #1
2 2748
Dan,

Are you sure you don't override the DataTable class somewhere in your code?
Try full class name System.Data.DataTable.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"mercercreek" <fo**********@hotmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
An attempt to create a stand-alone DataTable returns unexpected errors.

Using this bit of code - lifted from MSDN:

DataTable dt = new DataTable("Customers");

I get the following error: "No overload for method 'DataTable' takes
'1' arguments"

So, I remove the parameter and the compiler makes it as far as:

DataColumn dc = dt.Columns.Add("CustID", typeof(Int32));

At that point I get this error: "DataTable' does not contain a
definition for 'Columns'"

Sure enough, intellisense shows no "Columns" collection for the
DataTable class.
This appears contrary to documentation. Am I missing something?

Thanks
Dan

Nov 14 '06 #2

Eliyahu Goldin wrote:
Dan,

Are you sure you don't override the DataTable class somewhere in your code?
Try full class name System.Data.DataTable.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"mercercreek" <fo**********@hotmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
An attempt to create a stand-alone DataTable returns unexpected errors.

Using this bit of code - lifted from MSDN:

DataTable dt = new DataTable("Customers");

I get the following error: "No overload for method 'DataTable' takes
'1' arguments"

So, I remove the parameter and the compiler makes it as far as:

DataColumn dc = dt.Columns.Add("CustID", typeof(Int32));

At that point I get this error: "DataTable' does not contain a
definition for 'Columns'"

Sure enough, intellisense shows no "Columns" collection for the
DataTable class.
This appears contrary to documentation. Am I missing something?

Thanks
Dan
Dec 26 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Al Bastido via .NET 247 | last post by:
could somebody please explain to me how the datatable.newrow method works, i've been trying to figure it out for weeks. I need to emulate it myself. I can bind my datagrid to a collection of...
6
by: Mountain Bikn' Guy | last post by:
When one gets a row from a database (ie, a DataTable), the row contains a typed value in each column. How is this typically implemented behind scenes. I want to build this functionality myself. The...
1
by: bubby | last post by:
Should I be concerned about the classic "Deep/Shallow" copy problem when returning objects, specifically a DataTable or DataView from a method? For example, see the code below: private...
5
by: Thomas Scheiderich | last post by:
I am having a problem with a Datatable access. This statement apparently works fine: response.write(GetRows.Rows(ktr)(1)) and this statement does not: if e.day.date = GetRows(ktr)(1) then
9
by: Rui Sampainho | last post by:
Hi Is there any command to transfer the contents of a datatable to an array. What I'm looking for is sort of a bulk process, not an iteration with a loop based on a field by field or row by row...
4
by: Joe | last post by:
If I create a simple collection with say 20 columns and 5000 row and a DataTable with the same and serialize both, the DataTable file is at least 2 times the size as the simple collection. What is...
7
by: Susan Mackay | last post by:
I have a data table that is connected to a database table with a data adapter in the 'standard' manner. However I want to be able to remove selected rows from the data table (i.e. no longer...
4
by: =?Utf-8?B?UmljaA==?= | last post by:
Hello, In my vb2005 app I create 3 datatables in the Datasource area, tbl1, tbl2, tbl3. tbl1 contains 1 column, tbl2 contains 2 columns tbl3 contains 3 columns. Based on selections from a...
0
by: frostbb | last post by:
Ok, stumped one more time, I'm trying to learn how to use a DataGridView in place of the old DataGrid control. QUESTION: How do I map the columns returned from a RunTime sql query to the columns...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.