Before start of resultset exeception in java jdbc exception

try {
    String sql ="select * from staff where id=? ";

    pst=conn.prepareStatement(sql);
    pst.setString(1,txt_search.getText());
    rs=pst.executeQuery();

    String add1 =rs.getString("id");
    txt_empid.setText(add1);

    String add2 =rs.getString("Name");
    txt_firstname.setText(add2);

    String add5 =rs.getString("Salary");
    txt_salary.setText(add5);

}catch(Exception e){
    JOptionPane.showMessageDialog(null, e);
}

here I have some problem in setString method. Can you please explain the reason for this error. I try lot of ways is this a problem of jdbc