Well, I believe you should always put this line on the first line of the page :)

--
James

Kostas Karkaletsis wrote:

 I wrote the following simple code to query a databaseI use MS IIS and JrunWhen I browse this page I get the message

500 Internal Server Error

JSP Parse Error

JSP Directive <%@  %> contenttypeis not recognized.
Does anyone knows soemthing about it? <html> <head>
<title>New Page 1</title>
</head> <body> <%@ page contentType="text/html; charset=windows-1253" %>
<% Connection dbCon;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
dbCon = DriverManager.getConnection("jdbc:odbc:cafejava","","");
Statement stmt=null;
ResultSet rs=null;
String m_name=null;
int numColumns=0;
ResultSetMetaData rsmd =null;  
StringBuffer qry = new StringBuffer(1024);
qry.append("Select * from Persons");
stmt=dbCon.createStatement();
rs=stmt.executeQuery(qry.toString());
rsmd=rs.getMetaData();
numColumns=rsmd.getColumnCount();  
%>
<TABLE BORDER="1" BGCOLOR="#cccc99" BORDERCOLOR="#003366"> <%
while(rs.next())
{
%>
<TR>
<%
for (int column=1;column<=numColumns;column++)
{
%>
<TD><%= rs.getString(column) %></TD>
<%
}
%>
</TR>
<%
} %>
</body> </html>



Karkaletsis Kostas
Electrical Engineer
Gnomon Informatics
e-mail: [EMAIL PROTECTED] 




Reply via email to