ลำดับที่ |
หัวข้อ |
โดย |
จำนวนผู้ตอบ |
วัน/เวลา
ที่ตั้งหัวข้อ
|
<%@ page import="java.sql.*" %>
<%@ page contentType="text/html; charset=TIS-620" %>
<%
int rowCount=0;
try{
String driverName = "sun.jdbc.odbc.JdbcOdbcDriver";
String ConnectionURL = "jdbc:odbc:admin";
Class.forName(driverName).newInstance();
Connection con = DriverManager.getConnection(ConnectionURL);
Statement stmt = con.createStatement();
String sql = "SELECT * FROM post" ;
/**/
ResultSet rs = stmt.executeQuery(sql);
while(rs.next()){
rowCount++;
//String topic = new String(request.getParameter("topic").getBytes("ISO8859_1"),"windows-874");
String id = rs.getString("id");
String topic= rs.getString("topic");
String name = rs.getString("name");
String reply = rs.getString("reply");
String postdate = rs.getString("postdate");
%>
<%
}
con.close();
}
catch(Exception e){
e.printStackTrace();
}
%>
จำนวนหัวข้อทั้งหมด =<%=rowCount%> หัวข้อ
|