public void SearchPatients(int Method, String key)
    {
        lslPatients.removeAll();
        ReturnedPatients = new ArrayList();
        
        if (key.equals(""))
        {
            tbxError.setText("Empty key words.");
            return;
        }
        int id = -1;
        try
        {
            id = Integer.parseInt(key);
        }
        catch(Exception e)
        {
            id = -1;
        }
        Patient_Controller PC = new Patient_Controller("localhost", DBName, DBAccount, DBPwd);
        switch(Method)
        {
            case 0:
                if(id<=0)
                {
                    tbxError.setText("Please input a positive ID number.");
                    return;
                }
                ReturnedPatients = PC.SearchPatient(id);
                break;
            case 1:
                ReturnedPatients = PC.SearchPatient(key);
                break;
            default:
                String[] names = key.split(" ");
                if (names.length>=2)
                    ReturnedPatients = PC.SearchPatient(names[0], names[1]);
                else
                    ReturnedPatients = PC.SearchPatient(key, "");
                break;
        }
        if (ReturnedPatients.size()<=0)
        {
            tbxError.setText("No patients found");
            String[] temp = new String[1];
            temp[0]="";
            lslPatients.setListData(temp);
        }
        else
            tbxError.setText(String.valueOf(ReturnedPatients.size())+" patient(s) returned.");
        ShowPatients();
    }