I have a form with a data grid on it, theres 2 text boxes the user enters there username and password and it goes to the database that works fine..but ive got the code where it Updates the Datagrid straight away but it duplicates all the other data in the database aswell..Sorry if its confusing heres my code for INSERT
Try
CommandInsert.Parameters.Add(New OleDbParameter("Username", txtUsername.Text))
CommandInsert.Parameters.Add(New OleDbParameter("Password", txtPassword.Text))
CommandInsert.ExecuteNonQuery()
If MsgBox("Data Added") Then
loaddata()
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
LoadData() is the code that Updates the Database with the new information
Public Sub loaddata()
Try
connection.Open()
Catch ex As Exception
MsgBox(" " & ex.Message)
End Try
adapter.Fill(datatable)
datagrid.DataSource = datatable
End Sub
As i said it duplicates everything in the table plus the new information.. i Just want the new information to be added.. Thank You for your time :)