I have trouble counting the rows of my sqltable. Using just the query in MS Studio works fine but when I try in Java I get an sql exception:
Connection con = null;
    Statement stat = null;
    int result = 0;
    int i;
    try {
        con = DriverManager.getConnection("jdbc:sqlserver://localhost:1433;user=sa;password=123456; databaseName=RPA;");
        stat = con.createStatement();
        result = stat.executeUpdate("select count(*) FROM RPA_Users");
    }catch (SQLException e) {
        System.out.println("cannot connect!");
        e.printStackTrace();
    } finally {
        if (con != null) {
            try {
                con.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
    }
    return result;
Could someone explain me what I'm doing wrong? Thanks in advance
EDIT: Nevermind I already found it guys, thanks as usual for the help! My solution if someone is interested:
result = stat.executeQuery("select count(*) FROM /tablename/"); 
        result.next();
        rowCount = result.getInt(1);    
 
     
    