Remove thread double thread occured

Hi guys what I want to do is when my play button is pressed is read my PLAYCOUNT from my database and then the counter adds a value onto the PLAYCOUNT pre existing value then saves the value into the database. If I then close the program the counter will start from the new value. Therefore how do I do this?

My code can be seen below:

int counter;
    

    public void actionPerformed(ActionEvent e) {
        
        
         if (e.getSource() == play) { // if list button is pressed following statement will take place
         String v = videoNo.getText();
             counter++;
             String writeString =
                     "UPDATE VIDEOS SET PLAYCOUNT = '" + counter +"' WHERE VIDEOID = '"+ v + "'";
            try {
                myStatement.executeUpdate(writeString);
            } catch (SQLException sqle) {
               
            }
        try {
                ResultSet results = myStatement.executeQuery
                        ("SELECT * FROM VIDEOS WHERE VIDEOID = '1' ");
                while (results.next()) {
                    out.append(results.getString(5) + " ");

                }
                
                results.close();
            } catch (SQLException sqle) {
                out.println(sqle);
            }
        }
  
    }

}

What do you mean a "double thread" occurred? On Daniweb, there is no such thing as a double thread.
Also, with it's excellent systems, a duplicate thread cannot be made by mistake.
Plus the titles are different.

What do you mean a "double thread" occurred? On Daniweb, there is no such thing as a double thread.
Also, with it's excellent systems, a duplicate thread cannot be made by mistake.
Plus the titles are different.

I edited title

Threads merged. Please stop messing around with creation of new threads just because you wanted change thread title. Secondly many of this thread should stay with original question as they are only update on the work you do...

Hi there guys can someone explain to me how I can increment a value within a field in my database each time I execute my query?. As I cannot seem to find a way to do this. Below is my structure for reading + writting to my database if you need it to help me with my problem.

Also the code below updates my selected column but each time sets my playcount back to '1'. I wish to each time add 1 to the existing value. For instance if the value was already 1 when the query is executed the value becomes 2.


Any help would be appreciated

Code below:

String v = videoNo.getText();
            
             String writeString =
                     "UPDATE VIDEOS SET PLAYCOUNT = '1' WHERE VIDEOID = '"+ v + "'";
            try {
                myStatement.executeUpdate(writeString);
            } catch (SQLException sqle) {
               
            }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.