Here is the code
- Code: Select all
rs1 = stm.executeQuery("Select * from tblStudent where ClassID='"+ ID +"'");
ResultSetMetaData rsmd = rs1.getMetaData();
int columns = rsmd.getColumnCount();
ColName = new Vector();
for(int i=1;i<=columns;i++)
{
[b]ColName.addElement(rsmd.getColumnName(i));[/b] }
while(rs1.next())
{
[b]Vector tmp = new Vector();
tmp.addElement(rs1.getString("RollNo"));
tmp.addElement(rs1.getString("StudentName"));
tmp.addElement(rs1.getString("Address"));
tmp.addElement(rs1.getString("Tel"));
tmp.addElement(rs1.getDate("BirthDay"));[/b]
MainData.addElement(tmp);
}
The first bold line is the problem.I run my project and i showed "java.lang.ClassCastException"
But in the second bold line,the same trick,same syntax and i had no problem.
Why?plz tell me


