sqlconnection sqlcon=new sqlconnection(数据库地址)
sqlcommand sqlcom=new sqlcommand("select id from 'table' order by id desc",sqlcon);
sqlcon.open();
sqldatareader read=sqlcom.executereader();
array list=new array();
while(read.read())
{
list.push(Int32.parse(read["id"].tostring()));
}
sqlcon.close();
list就是你要的数组了