Page 1 of 1

Simple insert to dataset

Posted: Mon 24 Sep 2007 22:48
by stroyer74
I'm attempting to do an insert to my dataset and am struggling. I'm still a bit new to a lot of this, so it is probably a simple error.

I already have a dataset configured using the data source configuration wizard (dataset name is "dsHR" and table is "employee"). I have my form fields bound to this dataset and it works without a problem (retrieving, updating).

I would like to insert new records using the same dataset, but am unsure of what my code should be to make this happen. Here is my code for the "NEW" button. It is currently only trying to insert a new record and save the ClockID. I receive no error when running this, but it doesn't update the database or the dataset.

Using VB.NET 2005.

Any suggestions? Thanks in advance, Sheldon



Private Sub btnNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNew.Click
Dim row = DsHR.employee.NewRow
row("clockid") = txtEmployeeID.Text
DsHR.employee.Rows.Add(row)

EmployeeTableAdapter.Update(DsHR.employee)
End Sub

Posted: Tue 25 Sep 2007 06:50
by Alexey
Please send your project to the address provided in the Readme.txt file.