日期:2014-05-18  浏览次数:20869 次

从数据库中查询生成XML,错误在哪里?
主要代码如下
Class.forName( "com.microsoft.jdbc.sqlserver.SQLServerDriver ").newInstance();      
String   url= "jdbc:microsoft:sqlserver://localhost:2433;DatabaseName=ASP ";
String   user= "sa ";  
String   password= "111111 ";  
Connection   conn=   DriverManager.getConnection(url,user,password);      
Statement   stamt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);      
 
ResultSet   rs=stamt.executeQuery( "select   *   from   register   for   xml   auto   where   username= ' "+get_username+ " ' ");
String   url1= "jdbc:microsoft:sqlserver://localhost:2433;DatabaseName=aaa ";
String   user1= "sa ";  
String   password1= "111111 ";  
Connection   conn1=   DriverManager.getConnection(url1,user1,password1);      
Statement   stamt1=conn1.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);      
 

String   login= "login ";

if(get_username.equals( "name "))
{
    response.sendRedirect( "notlogin.jsp ");
}


else{
          if(rs.next())
    login=rs.getString( "login_level ");
if(!(login.equals( "administrator ")))
      response.sendRedirect( "not_admin.jsp ");
}
我是初学,请朋友们指点

------解决方案--------------------
你这是滚动页查询吧