Need to update dataadapter from datagrid that doesn't contain field

  • Thread starter Thread starter Larry Woods
  • Start date Start date
L

Larry Woods

I have a datagrid that is carrying all fields of a record...except one. Now
I want to update the underlying database via a dataadapter. The update is
working but the field that is "left out" is not there, of course. How do I
get that field back into the datatable for the database update?

TIA,

Larry Woods
 
The table is created from a new row in a datagrid. The datagrid is
populated from a parameterized query. The user selects a name from a
combobox. The value is used in a parameterized query to select a group of
records related to the name (via a userid key field). Now the user adds a
record to the datagrid and I want to update the database via a dataadapter
update....BUT I need to add the userid to the new record before I write it
back to the database. That's why I need to FORCE a value into the userid
key field of the new record.

How do I do this?

TIA,

Larry Woods
 
Forgive me, but this seems a bit of a strange way of going about this.

In essence, you need to bind the DataGrid to a table, then fill the table
using the parameterised query as you suggest. Adding a row to the DataGrid
will add it to the table, you can insert the UderID from the ValueMember on
the ComboBox and then run and Insert Command to add new records to the
database.

HTH
 

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