Column names typed dataset

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to get the column names in a strongly typed dataset. If I
have a dataset and want to set RowError to the name of the column without
hardcoding it. I want a compile time error if the name of the column does not
exist in the dataset.

If I have a column named emailaddress in Dataset adressDataset I want to do
something like this

adressRow.RowError = adressDataset.adressTable.emailaddress.columnname
 
Hi,

Try with:
adressRow.RowError = adressDataset.adressTable.emailaddressColumn.columnname

where addressDataset is an instance of your strong typed dataset.
However, this won't work if your dataset is defined in another assembly...
 
Thanks for a quick reply!
The problem is that the dataset is defined in another assembly. Is there a
way to solve this? Does it work in version 2.0 of .Net framework?


Miha Markic said:
Hi,

Try with:
adressRow.RowError = adressDataset.adressTable.emailaddressColumn.columnname

where addressDataset is an instance of your strong typed dataset.
However, this won't work if your dataset is defined in another assembly...

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com


moguls said:
Is there a way to get the column names in a strongly typed dataset. If I
have a dataset and want to set RowError to the name of the column without
hardcoding it. I want a compile time error if the name of the column does
not
exist in the dataset.

If I have a column named emailaddress in Dataset adressDataset I want to
do
something like this

adressRow.RowError = adressDataset.adressTable.emailaddress.columnname
 
moguls said:
Thanks for a quick reply!
The problem is that the dataset is defined in another assembly. Is there a
way to solve this?

Not that I know of.

Does it work in version 2.0 of .Net framework?

Yes, it should.
 
Back
Top