Column names typed dataset

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
 
M

Miha Markic [MVP C#]

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...
 
G

Guest

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
 
M

Miha Markic [MVP C#]

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.
 

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

Top