How do I force a value into a datatable column?

L

Larry Woods

I have a datatable that has been created from a new row in a datagrid.
There is a field that is defined in the datatable that is NOT displayed in
the datagrid (key field), although the column IS defined in the datatable.
I want to force a value into the column before I update the dataAdapter.

How do I do this?

TIA,

Larry Woods
 
W

W.G. Ryan eMVP

Larry -- you can just reference the underlying row like
TableName.Rows[0][ColumnIndex] = Whatever;

If you want though, specify a defaultValue of the datacolumn, then you'll
have it as soon as you add the row - provided you know what you want it to
be.
 
L

Larry Woods

Thanks.

Missed the obvious...!

Larry

W.G. Ryan eMVP said:
Larry -- you can just reference the underlying row like
TableName.Rows[0][ColumnIndex] = Whatever;

If you want though, specify a defaultValue of the datacolumn, then you'll
have it as soon as you add the row - provided you know what you want it to
be.

--
W.G. Ryan MVP (Windows Embedded)

TiBA Solutions
www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
Larry Woods said:
I have a datatable that has been created from a new row in a datagrid.
There is a field that is defined in the datatable that is NOT displayed in
the datagrid (key field), although the column IS defined in the datatable.
I want to force a value into the column before I update the dataAdapter.

How do I do this?

TIA,

Larry Woods
 

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