Address List
<%
Connection conn = null;
ResultSet result = null;
Statement stmt = null;
ResultSetMetaData rsmd = null;
try {
Class c = Class.forName("com.mysql.jdbc.Driver");
}
catch (Exception e) {
System.out.println("Error occurred " + e);
}
try {
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/ADDRESS");
}
catch (SQLException e) {
System.out.println("Error occurred " + e);
}
try {
stmt = conn.createStatement();
result = stmt.executeQuery("SELECT * FROM AddressList");
}
catch (SQLException e) {
System.out.println("Error occurred " + e);
}
int columns=0;
try {
rsmd = result.getMetaData();
columns = rsmd.getColumnCount();
}
catch (SQLException e) {
System.out.println("Error occurred " + e);
}
%>
| " + rsmd.getColumnLabel(i) + " | ");
|---|
| " + result.getString(i) + " | ");


No comments:
Post a Comment