Smoolfglilm
New Member
Ok, I'm real new to ASP.NET and already having some problems. I'm trying to create a simple login page. I pass the username and password to a custom validation control. I populate a SQL string with the supplied data and run the SQL with a datareader. My problem is what do you do when there is no data returned from the database (ie. not a valid user). In old ASP, I would use the If object.EOF then ....<BR><BR>Any help w/this would be greatly appreciated.<BR>SteveWith a datareader you can do:<BR><BR>if (yourdatareader.Read()) then<BR> Response.Write("Valid User")<BR>else<BR> Response.Write("Not Valid")<BR>end if<BR><BR>Hope that helps!<BR><BR>TimThe yourdatareader.Read() method returns false at EOF... so you could do a loop like (VB.NET):<BR><BR>Do While yourrecordset.Read<BR> total += yourdatareader("amount")<BR>Loop<BR><BR>No need to specify any MoveNext... The Read method handles that...