Hi folks!
I have some doubt regarding Resultset validation. Here is the part of my
code:
String query="select * from userdetails where username='"+u1+"'";
ResultSet rs = stmt.executeQuery(query);
if(rs!=null)
{
out.println("Username is already in use !");
}
else
{
try
{
PreparedStatement ps=con.prepareStatement("insert into
userdetails(" + "username)" + "values('" +u1+ "'"+")");
ps.executeUpdate();
out.println("record inserted");
}
catch(Exception e)
{
out.println(e);
}
}
In the above code if-else is not working. So i need help how to validate
the resultset in IF statement. Compilation erroe is not there in the above
code, only runtime error is there.
I need in this way, if the username is already there in table , it should
flash message in the same html page "Username is already in use !".
otherwise it should insert record in table and flash message "record
inserted".
How to send the message to the same html page.
Help me with ur answer!!
saravanan.s
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Share information about yourself, create your own public profile at
http://profiles.msn.com.
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html