Hi All,
I cant update my database. Im using Access as the db. I retrieve the data and put it in a datagridview. I want to be able to edit the data in the datagridview and then store it into the db, but it just doesnt want to. in the gridview the change is there but when i check the db it hasnt changed
I cant insert into the table either
Whats wrong?? Please reply ASAP..... Thanks
I cant update my database. Im using Access as the db. I retrieve the data and put it in a datagridview. I want to be able to edit the data in the datagridview and then store it into the db, but it just doesnt want to. in the gridview the change is there but when i check the db it hasnt changed
I cant insert into the table either
Code:
Me.DAsrch.Fill(Me.DsSrch1, "Staff")
If Not newtext Is Nothing Then
Me.DsSrch1.Tables(0).Rows(e.RowIndex).Item(e.ColumnIndex) = newtext
End If
MessageBox.Show(Me.DsSrch1.Staff.Rows(e.RowIndex).Item(e.ColumnIndex))
Me.Com.Connection = Me.DBCon
Dim field As String = Me.GVStaff.Item(e.ColumnIndex, e.RowIndex).OwningColumn.DataPropertyName.ToString
Dim value As String = Me.GVStaff.Item(e.ColumnIndex, e.RowIndex).EditedFormattedValue
Dim value2 As String = newtext
Dim cprv As String = Me.GVStaff.Item(0, e.RowIndex).Value
Me.Com.CommandText = "Update Staff Set " & field & " = " & value2 & " WHERE CPR = " & cprv & ""
Me.DAsrch.UpdateCommand = Com
Try
Me.DBCon.Open()
Dim r As Integer = Me.Com.ExecuteNonQuery()
Me.DAsrch.Update(Me.DsSrch1, "Staff")
Me.DsSrch1.AcceptChanges()
Me.DBCon.Close()
Me.DAsrch.Fill(Me.DsSrch1, "Staff")
Whats wrong?? Please reply ASAP..... Thanks
Last edited by a moderator: