How do I force a value into a datatable column?

  • Thread starter Thread starter Larry Woods
  • Start date Start date
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
 
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.
 
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
 
Back
Top