make sure Request.QueryString["id"] != null, also you have a dr.Close() line which is wrongconn_str=ConfigurationSettings.AppSettings["SQLConnectionString"];
conn=new SqlConnection(conn_str);
conn.Open();
//update happyonline里downloadnum的数量
query_str = "update kfc_happyonline set downloadnum=downloadnum + 1 where id="+Request.QueryString["id"];                
comm=new SqlCommand(query_str,conn);
comm.ExecuteNonQuery();
//
query_str = "select count(url) as counts from kfc_happyonlinecount where url='"+url+"' and countdate=getdate() ";
comm = new SqlCommand(query_str,conn);dr = comm.ExecuteReader();
while (dr.Read()){
count = (int)dr["counts"];
}
//
dr.Close();
if (count==0){
Response.Write("00000000");
}