rawilken
asked on
VB post update in dataset
I have a windows form that has a datagridview on it. I have added a button under the datagridview that when clicked is supposed to post the changes made in the dataset back to the database. The database is an MS Access mdb. The code I have is not working...
Private Sub btnSaveTime_Click(sender As System.Object, e As System.EventArgs) Handles btnSaveTime.Click
Try
Me.dgvTime.Update()
Me.TblTimeBindingSource.En dEdit()
Me.TableAdapterManager.Upd ateAll(Me. _Times__Da taSet1)
MessageBox.Show("Data saved!")
Catch ex As Exception
MessageBox.Show("Update failed!")
End Try
End Sub
Private Sub btnSaveTime_Click(sender As System.Object, e As System.EventArgs) Handles btnSaveTime.Click
Try
Me.dgvTime.Update()
Me.TblTimeBindingSource.En
Me.TableAdapterManager.Upd
MessageBox.Show("Data saved!")
Catch ex As Exception
MessageBox.Show("Update failed!")
End Try
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The dataset is comprised of one table, tblTime, that has a primary key. I have one record in the table and that one record is to be updated by the user through the vb Windows form. The record has three fields/columns, ID and TmStart and TmEnd. The primary key is ID and it is AutoNumber.
I have another datagrid view that is similar except the input is a date in the yyy-mm-dd format and the table the dataset uses is tblDates.
I use this input from the user, combining the Start entries into one field and use that to filter data in other datagridviews through queries in the database. So far I have not been able to get the filter to work. It seems that the changes made in the time and dates datagridviews are not being saved properly.
I have another datagrid view that is similar except the input is a date in the yyy-mm-dd format and the table the dataset uses is tblDates.
I use this input from the user, combining the Start entries into one field and use that to filter data in other datagridviews through queries in the database. So far I have not been able to get the filter to work. It seems that the changes made in the time and dates datagridviews are not being saved properly.
Have you set up properly the column format of the Date field ?
You need to use MM (month) and not mm (minutes) format: yyyy-MM-dd
You need to use MM (month) and not mm (minutes) format: yyyy-MM-dd
ASKER