Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

Updating listview data overwrites all the data

Sup guys

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)


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!
Just load all the information into a listview (without MySqlAdapter) and then use SqlQueries to update, save, delete, add, etc. It's so much easier.
(Mar 5, 2013 10:52 AM)Occulta Wrote:  Just load all the information into a listview (without MySqlAdapter) and then use SqlQueries to update, save, delete, add, etc. It's so much easier.

Yes I was already thinking about doing that, but how would I edit that single line and not everything :/
(Mar 5, 2013 11:04 AM)Snoepie1012 Wrote:  Yes I was already thinking about doing that, but how would I edit that single line and not everything :/

MySQL Queries.. Like I said.

Code
UPDATE WHERE

http://www.w3schools.com/sql/sql_update.asp


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Java] by J. McCarthyOct 13, 2017 01:12 PM 0 147 Oct 13, 2017 01:12 PM
Last Post: J. McCarthy
[C#] by siimon00Sep 28, 2016 09:58 PM 5 200 Sep 28, 2016 09:58 PM
Last Post: some_dude13
[Java] by I FreezeJan 25, 2015 10:42 AM 3 124 Jan 25, 2015 10:42 AM
Last Post: Dialog