In the code below I've to use Pre-built DatabaseManager which has limited exposed functions.
Now I want to fetch resultset of query that gives country names.

DatabaseManager dbhandler = new DatabaseManager();
String query = "Select country_names from Country_Table;";
Vector vResult = dbHandler.getResult(query);   //getResult returns Vector

How can I extract names of the countries from this Vector?
I'm trying to use String[] but not able to.

Thank You

6 Years
Discussion Span
Last Post by kalpanakovuru

Hi Raul,

This is the code to set and get the values from vector variable,

Vector<String> vcountry =new Vector<String>();

        //    <E> Element type of Vector e.g. String, Integer, Object ...

        // add vector elements
        vcountry .add("country  1");
        vcountry .add("country   2");
        vcountry .add("country   3");
for(int i=0;i<vcountry .size();i++) // This loop is used to iterate values of vector
            System.out.println("Vector Element "+i+" :"+vcountry .get(i));

I hope this is useful to u...

Edited by peter_budo: Keep It Clear - Do wrap your programming code blocks within [code] ... [/code] tags

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.