Hi,
I have a listview filled with a table from database with:
Private Sub FillList ()
....
....
SQL = "SELECT * FROM Voti"
dataSetVoti = New DataSet()
mioDataAdapter = New OdbcDataAdapter(SQL, dbConn)
mioDataAdapter.Fill(dataSetVoti, "Voti")
For Each resDataRow In dataSetVoti.Tables("Voti").Rows
lstItem = ListView1.Items.Add(resDataRow("Voti"))
.....
Next
.....
.....
End Sub
Then if I Update the table with:
Dim cmdVoti As OdbcCommand
Dim dbWriter As OdbcDataReader
SQL = "UPDATE Voti SET Voti = " & votiToAdd & " WHERE Codice = " & CLng(lvi.SubItems(4).Text)
cmdVoti = New OdbcCommand(SQL, dbAccr)
dbWriter = cmdVoti.ExecuteReader
dbWriter.Close()
and then call FillList ()
the table in database is updated but I do not see any changes in listview until I perform another Update and see the changes for the previous record updated and not for the last one or I have to close the form and re-open it to see the updated records.
Which is the mistake?
Thank you in advance.
I have a listview filled with a table from database with:
Private Sub FillList ()
....
....
SQL = "SELECT * FROM Voti"
dataSetVoti = New DataSet()
mioDataAdapter = New OdbcDataAdapter(SQL, dbConn)
mioDataAdapter.Fill(dataSetVoti, "Voti")
For Each resDataRow In dataSetVoti.Tables("Voti").Rows
lstItem = ListView1.Items.Add(resDataRow("Voti"))
.....
Next
.....
.....
End Sub
Then if I Update the table with:
Dim cmdVoti As OdbcCommand
Dim dbWriter As OdbcDataReader
SQL = "UPDATE Voti SET Voti = " & votiToAdd & " WHERE Codice = " & CLng(lvi.SubItems(4).Text)
cmdVoti = New OdbcCommand(SQL, dbAccr)
dbWriter = cmdVoti.ExecuteReader
dbWriter.Close()
and then call FillList ()
the table in database is updated but I do not see any changes in listview until I perform another Update and see the changes for the previous record updated and not for the last one or I have to close the form and re-open it to see the updated records.
Which is the mistake?
Thank you in advance.