| qurratulain |
13Jan2007 16:56 |
assigning the variable to textfeild
sir
i trying to update the recin the database .jsp page fetches the data from the databse .and place the data in to the text feild . im trying to genrate the the registration no in the text feild automatically. with code given below but it is not working well,
i m using the code
Code:
<%@page import="java.sql.*"%>
<body>
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:school-db");
Statement stat=con.createStatement();
ResultSet rs=stat.executeQuery("SELECT COUNT(SID_GR) from Std-Info");
while(rs.next()){
String regno=rs.getString(1);
if(regno.equals("")){
regno=("SOE-"+0001);
}
else {
regno=("SOE-"+0000+regno);
}
}
String regno="SOE-0001";
%>
<html>
<head>
<title>home page of school</title>
<style type="text/css" media="all">
</style>
<link rel="stylesheet" type="text/css" href="styles.css" media="all" />
<LINK href="style.css" type=text/css rel=stylesheet>
</head>
<body>
<TR>
<TD class=infoboxcolumn width="15%" height=25>NAME:</TD>
<TD borderColor=#dddddd width="35%" height=25><INPUT name="ID" value=\"<% regno %>\"></TD></tr>//error is here
<tr> <TD >PASSWORD:</TD>
<TD ><INPUT type="password" name="Pass" value="pass"></TD></TR>
</TABLE><BR>
</CENTER>
</form>
</body>
<br/><br/> </html>
|