title: VB.NET tableadapter.update() not updating database
body: <p>I am trying to update records in a SQL DB from a VB.NET WF app and the tableadapter.update() command isn't working.</p>
  
  <p>At least <em>part</em> of the problem I'm having is errors with the primary key. For some reason it won't let me update all of the column values except for the PK. </p>
  
  <p>Here's my code for the "save" function, which is supposed to update the DB record based on  values in textboxes on the form.
  as you can see from the code below I've tried a few different methods of updating, but none seem to work. any help you guys could provide in pointing me in the right direction would be helpful.
  </p>
  
  <pre><code>Try
              If Ds.main.Rows.Count &lt;&gt; 0 Then
                  'send data to DT for editing
  
                  'rows to write
                  'Ds.main.Rows(searchIP.Text)("IP") = searchIP.Text
                  'Ds.main.Rows(searchIP.Text)("HOSTNAME") = searchHost.Text
                  'Ds.main.Rows(searchIP.Text)("SUBNET") = searchSubnet.Text
                  'Ds.main.Rows(searchIP.Text)("VLAN") = searchVLAN.Text
                  'Ds.main.Rows(searchIP.Text)("ALIVE") = searchAlive.Checked
                  'Ds.main.Rows(searchIP.Text)("RESERVED") = searchReserved.Checked
                  'Ds.main.Rows(searchIP.Text)("USR") = searchUser.Text
                  'Ds.main.Rows(searchIP.Text)("NOTES") = searchNotes.Text
                  'Ds.main.Rows(searchIP.Text)("FAIL") = searchFail.Text
                  'Ds.main.Rows(searchIP.Text)("date") = Date.Now
  
                  Ds.Tables("main").Rows(0).Item("notes") = searchNotes.Text
  
                  'writes changes to DB
                  Ds.AcceptChanges()
                  Me.MainTableAdapter.Update(Me.Ds.main)
  
                  ' refreshes the table on the All Hosts tab
                  Me.MainTableAdapter.Fill(Me.Ds.main)
  
  
                  ' clears all fields on the Search tab
                  boxSearch.Text = ""
                  searchIP.Text = ""
                  searchHost.Text = ""
                  searchSubnet.Text = ""
                  searchVLAN.Text = ""
                  searchUser.Text = ""
                  searchNotes.Text = ""
                  searchAlive.Checked = False
                  searchReserved.Checked = False
                  searchFail.Text = ""
                  searchDate.Text = ""
  
  
  
                  ' updates system message bar for 1 second
                  Dim tmCurTime As DateTime = Date.Now
                  Dim wait As Int16 = 1  ' Time in seconds
                  Do
                      sysmsg.Text = "Saved!"
                      sysmsg.ForeColor = Color.Green
                      Application.DoEvents()
                  Loop Until DateDiff(DateInterval.Second, tmCurTime, Date.Now) = wait
                  sysmsg.Text = ""
              End If
          Catch ex As Exception
              MsgBox("error" + ex.Message)
          End Try
  </code></pre>