import java.sql.*;
class studcmd
{
public static void main(String args[]) throws Exception
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:dbaccess","my","asa");
System.out.println("Connection Successful");

Statement stmt = con.createStatement();

ResultSet rs = stmt.executeQuery("select * from student where rno = " +args[0]);
if(rs.next())
{
//  System.out.println("\nThe Searched Record Of The Student No " +args[0]);
//  do
// {
  System.out.println("\nRollno : " + rs.getString(1) + "\nName : " + rs.getString(2) + "\nMarks : " + rs.getString(3));
// }while(rs.next());
}
else
 System.out.println("\n\tThe given roll no record is not found");  

}
}

Post a Comment

Previous Post Next Post