Dataadapter update not updating database
If you want to check the codes for records retrieval, here it is : If e.
Update(ds, "prms_patient") Msg Box("Record Added") Message Box. It won't have any error but it won't update the records. When I pressed the Save button, it will attempt to create a new row which is impossible because the So I have a maskedtextbox wherein you will enter the Patient Number (Primary Key, "pat_patno") and pressing the enter key, the records will be retrieved.
Change the data in the field or fields that contain duplicate data, remove the index, or redefine the index to permit duplicate entries and try again.
Close() clear() The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship.
Set Error(dtp Bday, "Invalid Birthday.") Return Else con.
Close() End If ' Codes for Contact Numbers If mtb Land.
However, that error points to a problem of trying to add a record that has a duplicated primary key or data integrity issues. Dim dt As New Data Table Dim ds As New Data Set ds. Fill(dt, "prms_patient") Dim new Row As Data Row = ds.
Add(newrow) Dim cb As New Ole Db Command Builder(da) da. Now that being said, the only thing it's probably going to resolve at this point is easier to follow code. It appears that an attempt is being made thus the error. This way you validate the input and leave the routine if there is an error without trying to add the new row. Open() Dim da As New Ole Db Data Adapter da = New Ole Db Data Adapter("select * from prms_patient", con) da.