@JM

Hi i tried your codes to retrieve and update data in my textbox which is bound to a field in database. When i launch the application the textbox does not display the data?? can you tell me what could be possibly wrong??

vb Code:
  1. Private connection As New SqlClient.SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=D:\ProjectMW\MachineWale\MachineWale\DatabaseMW.mdf;Integrated Security=True;User Instance=True")
  2.     Private adapter As New SqlClient.SqlDataAdapter("SELECT kmsrun FROM machineprofile", connection)
  3.     Private table As New DataTable
  4. Private Sub InitialiseDataAdapter()
  5. Dim update As New SqlClient.SqlCommand("UPDATE machineprofile SET kmsrun = '" & TextBox10.Text & "' WHERE MachineID = '" & TextBox1.Text & "'", Me.connection)
  6. Me.adapter.UpdateCommand = update
  7.         Me.adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey
  8.  
  9. Private Sub GetData()
  10.        
  11.         Me.adapter.Fill(Me.table)
  12.  
  13. End Sub
  14.  
  15. Private Sub SaveData()
  16.                Me.adapter.Update(Me.table)
  17. End Sub