DataTables why 2 tables in dataset cannot have same column name

  • Thread starter Thread starter Krish
  • Start date Start date
K

Krish

I have created 2 tables, both tables have the same column names (property
ColumnName) it is priceDate,priceTime and priceValue


I get an error saying that Column priceDate already belongs to another datatable .

Is it correct that the 2 tables cannot have the same column names.

I am trying to create a data relation to get the common dates.

thanks
 
Krish,

There should be no reason that you can not add a column with the same
name to two different tables. Are you adding a column that already belongs
to another table, or are you trying to create a new column?
 
Krish said:
I have created 2 tables, both tables have the same column names (property
ColumnName) it is priceDate,priceTime and priceValue

I get an error saying that Column priceDate already belongs to
another datatable .

Is it correct that the 2 tables cannot have the same column names.

I am trying to create a data relation to get the common dates.

Two tables can definitely have the same column names. It could be the
relation that's causing the problem.

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.
 
Krish,
In addition to the other comments.
I get an error saying that Column priceDate already belongs to another
datatable .
You need to create a new DataColumn object for each DataTable, however both
DataColumns have the same value for the ColumnName property!
Is it correct that the 2 tables cannot have the same column names.
You are free to use the same name in multiple tables.
I am trying to create a data relation to get the common dates.
You need to use DataColumn objects specific to both tables to create the
relationship.

Hope this helps
Jay
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top