J
Joe S.
Hello,
I have a form that is used only to insert data into a database. It is
composed of a datagrid which is used only for displaying data and selecting
rows and a few text and combo boxes for the actual data editing.
What I want to do is bind these to a data source, but I am not exactly sure
how to handle the comboboxes which show data from a standard lookup table
(int id, nvarchar something). I displayed data from lookup tables by binding
their ValueMember and DataMember properties.
When the user clicks a row in the datagrid, the data from that row should
appear in the other controls for editing. The comboboxes should show the
data from the selected row, but how can they do this if they are already
bound to lookup tables?
A possible workaround is to bind the comboboxes to the lookup tables when a
new record is being created, and to the datagrid's datasource later. This
has its own share of problems, of course.
Maybe I should describe these relations in a dataset, and rely on the data
binding mechanism to figure out what is supposed to be in the combo boxes?
The problem with this is that I do not need a SELECT statement, because this
form is write-only. What do I do with the DataAdapter.Fill() and
DataAdapter.SelectCommand then?
I hope I made myself clear. If any clarifications are needed, do not
hesitate to ask.
Regards,
Joe
I have a form that is used only to insert data into a database. It is
composed of a datagrid which is used only for displaying data and selecting
rows and a few text and combo boxes for the actual data editing.
What I want to do is bind these to a data source, but I am not exactly sure
how to handle the comboboxes which show data from a standard lookup table
(int id, nvarchar something). I displayed data from lookup tables by binding
their ValueMember and DataMember properties.
When the user clicks a row in the datagrid, the data from that row should
appear in the other controls for editing. The comboboxes should show the
data from the selected row, but how can they do this if they are already
bound to lookup tables?
A possible workaround is to bind the comboboxes to the lookup tables when a
new record is being created, and to the datagrid's datasource later. This
has its own share of problems, of course.
Maybe I should describe these relations in a dataset, and rely on the data
binding mechanism to figure out what is supposed to be in the combo boxes?
The problem with this is that I do not need a SELECT statement, because this
form is write-only. What do I do with the DataAdapter.Fill() and
DataAdapter.SelectCommand then?
I hope I made myself clear. If any clarifications are needed, do not
hesitate to ask.
Regards,
Joe