I am have a horrible time trying to get this update to work correctly in my datagrid. I had it working yesterday and when i came in this morning it would not function right. I am trying to get the datagrid to add today's date (through lbltdatedisp label)to the paid column in my datagrid. I want it to only update those rows in the paid column that do not have a date already marked in them...this way I can keep track of when each row was marked paid. Below is my code....also, in the access db that it is connected to..the paid field is a text field , not a time/date so it should be able to compare "" to the field contents. Can anyone find a reason why this is not working...even if it looks good, i would like to know so I can move on to another part of the code and narrow it down that way. Thanks, Brent
Private Sub btnupdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnupdate.Click
If DsInvoice1.HasChanges Then
If MessageBox.Show("You are about to save all changes made in the Datagrid, Continue?", "InvoiceHistory", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) = DialogResult.OK Then
'Da.Update(detail, "InvoiceHistory"
Try
Dim dr As DataRow
For Each dr In DsInvoice1.Tables(0).Rows
If dr.Item("Paid"
= "" Then
dr.Item("Paid"
= lbltdatedisp.Text
End If
Next
OleDbDataAdapter1.Update(DsInvoice1)
grdComm.Refresh()
Catch Ex As OleDbException
System.Diagnostics.Debug.Write(Ex.Message)
End Try
End If
End If
Private Sub btnupdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnupdate.Click
If DsInvoice1.HasChanges Then
If MessageBox.Show("You are about to save all changes made in the Datagrid, Continue?", "InvoiceHistory", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) = DialogResult.OK Then
'Da.Update(detail, "InvoiceHistory"
Try
Dim dr As DataRow
For Each dr In DsInvoice1.Tables(0).Rows
If dr.Item("Paid"
dr.Item("Paid"
End If
Next
OleDbDataAdapter1.Update(DsInvoice1)
grdComm.Refresh()
Catch Ex As OleDbException
System.Diagnostics.Debug.Write(Ex.Message)
End Try
End If
End If