SqlConnection conn=...SqlCommand com=new SqlCommand(conn,"select * from login where id='"+id+"' and psw='"+psw+"'")DataReader dr=com.executeReaderif dr.movenext then dim sd$=dr.getString(2)endifsession.xxxx
'照记忆打的,好久不用了。大致这样子