I had write a simple program using visual basic 2008 express edition for displaying the voting. I am using mySQL as my database, the program have to retrieve data by a SQL statement from my database. Whenever i click on start button, it should be refresh and retrieve the lastest data in mySQL database.
My problem is that when i load the program, so called a "formload", and click on the start button, it will display the correct data from database, but when i click the button second time, it does not refresh and display the latest data.
This program is done by me who is a newbie in visual basic, this is the only problem i met, i have to settle it in 1 weeks time. But until now i still cant find the solution, anyone please help me on that?
My code for my program start button as below
Private Sub btn2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn2.Click
Private Sub btn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnstart.Click
Dim MysqlConn As MySqlConnection
MysqlConn = New MySqlConnection()
' Define the SQL to grab data from table.
SQL = "SELECT count('content') FROM loglog where content = 'M1'"
What do you mean by it does not refresh and display the latest data?
How do you know the data has been changed? Have you tried running the underlying queries directly against MySQL to make sure it's not the SQL itself that's causing undesirable results? Your bindings look fine, but you don't have anything in there that looks like it would cause an insert/update.