Quantcast
Viewing all articles
Browse latest Browse all 27201

VS 2010 Updating listview data overwrites all the data

Hello everyone, suprising my first post on this forum :p

I made a application that would retrieve information from my Mysql database and put it in a Listview (Under categories such as name, email, ...)
I made it so when you double click a data line in the Listview a new form would open with textboxes with the data in it so you could edit it.

However when you edit some data and then click the 'Save' button all the listview items are changed (Not just the line you double clicked but also the data under it)

So this:

Attachment 97355

Becomes this when you edit the name in the form to 'this' in the first line:

Attachment 97357


My code to change the listview item:

Code:

  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim con As MySqlConnection = New MySqlConnection("Data Source=localhost;Database=fca;User ID=root;Password=;")
        strsql = "Update informatie set Naam = '" & TextBox1.Text & "', Bijvoegsel = '" & TextBox2.Text & "', Achternaam = '" & TextBox3.Text & "'"
        Dim da As New MySqlDataAdapter(strsql, con)
        da.Fill(ds)
        Me.Hide()

        Form2.list()
    End Sub


Hope someone can help me! If you need more information just ask.

Thanks!
Attached Images
Image may be NSFW.
Clik here to view.
  Image may be NSFW.
Clik here to view.
 

Viewing all articles
Browse latest Browse all 27201

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>