Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


How to find total column from a resultset?

Answers were Sorted based on User's Feedback



How to find total column from a resultset?..

Answer / manik chand

resultSet.getMetaData().getColumnCount().

Is This Answer Correct ?    8 Yes 0 No

How to find total column from a resultset?..

Answer / shankar

int columnCnt = java.sql.ResultSetMetaData.getColumnCount();

Is This Answer Correct ?    7 Yes 1 No

How to find total column from a resultset?..

Answer / rajshri

import java.sql.*;

class columncount
{
public static void main(String[]args)
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection
("jdbc:odbc:mydsnname");
Statement st=con.createStatement();
String sql="select * from table_name";

ResultSet rs=st.executeQuery(sql);
ResultSetMetaData rd=rs.getMetaData();
int k=rd.getColumnCount();
System.out.println("no of count is " +k);
}
catch(SQLException e1)
{
System.out.println("not working");
}

Is This Answer Correct ?    5 Yes 0 No

How to find total column from a resultset?..

Answer / tathagata

First one is the correct ans.2nd & 3rd will be return
toatal no rows not column.

Is This Answer Correct ?    0 Yes 1 No

How to find total column from a resultset?..

Answer / thiyagu

rs.getRow();

Is This Answer Correct ?    1 Yes 6 No

How to find total column from a resultset?..

Answer / ramu

while(rs.next())
{
getInt(1);
}

Is This Answer Correct ?    0 Yes 7 No

Post New Answer

More JDBC Interview Questions

What class.forname does, while loading the drivers?

0 Answers  


Why do we need jdbc driver?

0 Answers  


Are there any ODBC drivers that do not work with the JDBC- ODBC Bridge?

2 Answers  


what is connection pooling?

6 Answers   Wipro,


Can the JDBC-ODBC Bridge be used with applets?

2 Answers  






What is the difference between jdbc and odbc?

0 Answers  


What types of DataSource objects are specified in the Optional Package?

0 Answers  


Compare jdbc and odbc and how is jdbc required in this context.

0 Answers  


What is jdbc and jdbc drivers?

0 Answers  


When does the result for an sql statement return null?

0 Answers  


Which is faster jdbc or odbc?

0 Answers  


What are the functions of the jdbc connection interface?

0 Answers  


Categories