curtissumpter 0 Light Poster

Hello,

I have this piece of code.

Help with Code Tags
java Syntax (Toggle Plain Text)

private Vector getColumn(ResultSet rs)
	        throws SQLException
	        {
	            Vector row = null; 
	            ResultSetMetaData rsmd = null;
	            boolean moreResults = rs.next(); 
	            if (moreResults)
	            {
	            	row = new Vector();
	            	rsmd = rs.getMetaData();
	                do
	                {
	                	switch(rsmd.getColumnType(1))
	                	{
	                	case Types.VARCHAR:
	                		row.addElement(rs.getString(1));
	                		System.out.println(rs.getString(1));
	                		break;
 
	                	case Types.INTEGER:
	                		row.addElement(new Integer(rs.getInt(1)));
	                		System.out.println(rs.getString(1));
	                		break;
 
 
	                	case Types.FLOAT:
	                	row.addElement(new Float(rs.getFloat(1)));
	                		System.out.println(rs.getString(1));
	                		break;
 
	                	default:
	                		System.out.println("Column Type: " + rsmd.getColumnTypeName(1));
                	}
                }while(rs.next());
            }
            return row;
	        }

However, it will not catch the Float data type. I tried it with double, etc, but it will not work. The output that I get is the following:

select iID from items
101
102
103
104
select description from items
Watch
T-Shirt Collection
Heavy Duty Tea Cup
Shirts
select highestBid from items
Column Type: FLOAT
Column Type: FLOAT
Column Type: FLOAT
Column Type: FLOAT
Size of descArray: 4

Any suggestions on how to get the code to read data type Float?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.