I am working on a desktop application. The functional is realized in a class of a specific package. My code is as follows
public void cargarComboCurso()
{
String url = "jdbc:sqlserver://localhost:1433;databaseName=Escuela";
String user = "user";
String password = "password";
String sql = "SELECT nombreCurso FROM Cursos";
try(Connection cn = DriverManager.getConnection(url, user, password);
Statement st = cn.createStatement();
ResultSet rs = st.executeQuery(sql);)
{
cboCurso.removeAllItems();
while (rs.next())
{
cboCurso.addItem(rs.getString("nombreCurso"));
}
}
catch(SQLException e)
{
System.out.println("ERROR : ");
e.printStackTrace(System.out);
}
}
The problem is that my combo cboCurso is in a JFrame of another package and when I can not access it, the program throws me an error of can not find symbol