ronlahav
Jan 30th, 2003, 05:29 AM
hi there
i use form in which i have several textboxes through which i want to update a table that located in a dataset (and from there i can update my database).
i notice that i can do it with 2 technique
1. to create datarow object array typed and like a new row in my Dataset.Table and by index to fill the object array with the .Text property of my textbox. i find it more easy because before i add the new row to my table i can check validations so that the user didnt misstype i can also check if the row is not exists in my dataset and then add it.
Dim NewRow As DataRow = sCompanies1.T_Companies.NewRow
NewRow(1) = TextBox1.Text
checks()
2. to databinding the row outomatically bounds to the appropriate empty row
but!!! i cant trace validations unless the DataRelations in the dataset is "shouting" if you know what i mean....
Me.TextBox1.DataBindings.Add(New Binding("Text", DsCompanies1, "T_Companies.comp_AddressHeb"))
button for add new empty row in my dataset
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.BindingContext(DsCompanies1, "T_Companies").AddNew()
End Sub
button for add the row to my dataset
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.BindingContext(DsCompanies1, "T_Companies").EndCurrentEdit()
End Sub
i use form in which i have several textboxes through which i want to update a table that located in a dataset (and from there i can update my database).
i notice that i can do it with 2 technique
1. to create datarow object array typed and like a new row in my Dataset.Table and by index to fill the object array with the .Text property of my textbox. i find it more easy because before i add the new row to my table i can check validations so that the user didnt misstype i can also check if the row is not exists in my dataset and then add it.
Dim NewRow As DataRow = sCompanies1.T_Companies.NewRow
NewRow(1) = TextBox1.Text
checks()
2. to databinding the row outomatically bounds to the appropriate empty row
but!!! i cant trace validations unless the DataRelations in the dataset is "shouting" if you know what i mean....
Me.TextBox1.DataBindings.Add(New Binding("Text", DsCompanies1, "T_Companies.comp_AddressHeb"))
button for add new empty row in my dataset
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.BindingContext(DsCompanies1, "T_Companies").AddNew()
End Sub
button for add the row to my dataset
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.BindingContext(DsCompanies1, "T_Companies").EndCurrentEdit()
End Sub