public override MembershipUserCollection FindUsersByName (string nameToMatch, int pageIndex, int pageSize, out int totalRecords)
{
CheckParam ("nameToMatch", nameToMatch, 256);
if (pageIndex < 0)
throw new ArgumentException ("pageIndex must be >= 0");
if (pageSize < 0)
throw new ArgumentException ("pageSize must be >= 0");
if (pageIndex * pageSize + pageSize - 1 > Int32.MaxValue)
throw new ArgumentException ("pageIndex and pageSize are too large");
using (DbConnection connection = CreateConnection ()) {
DbCommand command = factory.CreateCommand ();
command.Connection = connection;
command.CommandText = @"aspnet_Membership_FindUsersByName";
command.CommandType = CommandType.StoredProcedure;
AddParameter (command, "@PageIndex", pageIndex);
AddParameter (command, "@PageSize", pageSize);
AddParameter (command, "@UserNameToMatch", nameToMatch);
AddParameter (command, "@ApplicationName", ApplicationName);
// return value
AddParameter (command, "@ReturnValue", ParameterDirection.ReturnValue, null);
MembershipUserCollection c = BuildMembershipUserCollection (command, pageIndex, pageSize, out totalRecords);
return c;
}
}