这个程序是随机抽取手机号码,要求不重复,在线等待,急急急急急
/**
*
* <pre>
* 项目:SMS
* 模块:短信息
* 功能:用户订阅短抽奖
* 其他说明:
* 1)暂无.
* 2)
*
* Company: TOL24.COM
* </pre>
* @author 杨津松
* @version 1.0
* @since 2003/04/09
*/
package com.tol24.sms ;
import java.sql.* ;
import javax.sql.* ;
import com.tol24.database.* ;
import com.tol24.util.* ;
public class takeaward
{
public static void main( String[] args )
{
try
{
String strSQL =
"select Count(distinct phoneno) AS Rowcount from subscription,smsuser,product where subscription.userid=smsuser.id "
+
"and product.payway='03' and subscription.productid=product.id and subscription.status=1 and product.status=1" ;
RowSet rs = DBManager.executeQuery( strSQL ) ;
rs.next() ;
//生成1和总条数之间的随机数.
int allcount = rs.getInt( "ROWCOUNT" ) ;
System.out.println( "allcount" + allcount ) ;
int iTemp = 0 ; //位置变量
String[] phoneNO = new String[ 100 ] ;
strSQL = "select distinct phoneno from subscription,smsuser,product where subscription.userid=smsuser.id "
+
"and product.payway='03' and subscription.productid=product.id and subscription.status=1 and product.status=1" ;
rs = DBManager.executeQuery( strSQL ) ;
rs.next() ;
iTemp = util.getRandomInteger( 1, allcount ) ;
rs.absolute( iTemp ) ;
String awardphoneNO = rs.getString( "phoneno" ) ;
System.out.println( "一等奖号码" + awardphoneNO ) ;
phoneNO[ 0 ] = awardphoneNO ;
int awardcount = 0 ;
while ( awardcount < 56 )
{
iTemp = util.getRandomInteger( 1, allcount ) ;
rs.absolute( iTemp ) ;
awardphoneNO = rs.getString( "phoneno" ) ;
System.out.println( "awardcount" + awardcount ) ;
for ( int i = 0 ; i <= awardcount ; i++ )
{
System.out.println("i="+i);
System.out.println( "phoneNO" + phoneNO[ i ] ) ;
if ( !phoneNO[ i ].equals( awardphoneNO ) )
{
awardcount++ ;
phoneNO[ awardcount ] = awardphoneNO ;
if ( awardcount < 6 )
{
System.out.println( "二等奖号码" + awardphoneNO ) ;
}
else
{
System.out.println( "三等奖号码" + awardphoneNO ) ;
}
}
}
}
}
catch ( SQLException e )
{}
}
}
这个程序是随机抽取手机号码,要求不重复
现在,结果发现变量i不变化,请问为什莫