|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Binding of textboxes to a empty tableI am looking for a solution of an "simple" problem, but I dont found it. I have a dataset with to tabels on it. On a Form i have a lot of TextBoxes to display the data from two database tables. The databinding of the TextBoxes is linked to two BindingSource-Objects (.NET 2.0). BindingSource1 connect to table1 at my dataset, BindingSource2 connect to table2. That works fine (changed data are updated at the database) if both tables are filled with rows. If table2 have no rows (no address of a person is known) it is possible to fill in data into the textboxes, but the data are not saved into the dataset (no row is created and filled). What is the best way to solve this? Is there any event of BindingSource? Table? (or what?) witch give me the information that a new rows is needed. Is it possible to force the BindingSource to create an new Row? Because of the checks at my dataset i need to set some columns (foreign key ...) by myself. Thanks in advance for any help. Niels Hallo folks,
i found a solution which is good enough for me. If i get an empty table i create an an dummy row from this table WITHOUT adding it to the table. Instead of binding the Textboxes to the table I bind them to this new row. If this row need to save into the database I check if the user fill in some data. If he typed in data I complete the row with foreign keys ... and add the row to the table. Then the Dataset-Update() was called to save data at the Datebase. That works fine. Niels Show quote > Hi folks, > I am looking for a solution of an "simple" problem, but I dont found it. > > I have a dataset with to tabels on it. > On a Form i have a lot of TextBoxes to display the data from two database > tables. > The databinding of the TextBoxes is linked to two BindingSource-Objects > (.NET 2.0). BindingSource1 connect to table1 at my dataset, BindingSource2 > connect to table2. > > That works fine (changed data are updated at the database) > if both tables are filled with rows. If table2 have no rows (no address > of a person is known) it is possible to fill in data into the textboxes, > but the data are not saved into the dataset (no row is created and filled). > > What is the best way to solve this? > > Is there any event of BindingSource? Table? (or what?) witch give me > the information that a new rows is needed. Is it possible to force > the BindingSource to create an new Row? Because of the checks > at my dataset i need to set some columns (foreign key ...) by myself. > > Thanks in advance for any help. > > Niels |
|||||||||||||||||||||||