rohit manhas

rohit manhas

  • NA
  • 25
  • 0

convert JSP code to c#

Apr 24 2010 12:38 AM

i want to convert this code to c#..and if possible cud anyone explain me, what happens in the below code.....
............................................................................................................................................................................

ResultSet resultset;
            try {
                    Connection connection = DriverManager.getConnection("jdbc:odbc:rmcwhDSN");
                    Statement statement = connection.createStatement();
                    resultset=statement.executeQuery("select * from LoginTable");
                    String user="";
                    String pass="";
                    String role="";
                    String prefix="";
                    String temprole="ADMIN";
                    int flag = 0;                
                    if((request.getParameter("UserId") != null)  && (request.getParameter("Password") != null))
                   {
                        user=request.getParameter("UserId");
                        pass=request.getParameter("Password");
                        
                   }
                    while(resultset.next())
                   {
                        String UserId = resultset.getString("UserId");
                        String Password = resultset.getString("Password");
                      
                        role=resultset.getString("Role");
                        out.println("role"+role);
                        prefix = resultset.getString("Prefix");
                        //if role is "ADMIN" then by defalt asign prefix as "XXX"
                        if(( UserId.equals(user) ) && (Password.equals(pass)) && (role.equals(temprole)))
                       {
                            flag = 2;
                            session.putValue("UserId", user);
                             session.putValue("Role",role);
                            session.putValue("Prefix", prefix);
                           
                            
                        }
        
                    
                        
                        
                        
                          else if(( UserId.equals(user) ) && (Password.equals(pass)))
                       {
                            flag = 1;
                            session.putValue("UserId", user);
                           
                            session.putValue("Role",role);
                            //out.println("role"+role);
                             session.putValue("Prefix", prefix);
                            
                        }
                        
                             
    }

Answers (4)