How to find total column from a resultset?
Answers were Sorted based on User's Feedback
Answer / shankar
int columnCnt = java.sql.ResultSetMetaData.getColumnCount();
| Is This Answer Correct ? | 7 Yes | 1 No |
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 |
Where jdbc drivermanager class is used?
What are the flow statements of jdbc?
What are the methods which can verify the cursor particular position?
What is CLOB and BLOB datatypes in JDBC?
What is the difference between ojdbc6 and ojdbc7?
How do you determine the sensitivity of the ResultSet object?
what are the advantages of JDBC?
What is jsp and jdbc?
What is the meaning of “dirty read” in the database?
What is the use of setFetchSize() and setMaxRows() methods in Statement?
How to find number of records in result set?
What does jdbc do?