public bool CharacterCheck(string name)
{
//Set new bool taken
bool Taken = false;
//Wrap with catcher
try
{
//If name lenght higher is then 3 characters and lower then 12 characters
if (name.Length > 3 && name.Length < 12)
{
//Check name in database
string dbname = MsSQL.GetData("SELECT name FROM character WHERE name='" + name + "'", "name");
//If the name does not excist
if (dbname == null)
{
//Set bool to false
Taken = false;
}
//If name excists, bool is true
else Taken = true;
}
//Finally if name lenght is wrong taken is true
else
{
Taken = true;
}
}
catch (Exception ex)
{
Console.WriteLine("Character Name Check Error {0}", ex);
Systems.Debugger.Write(ex);
}
//Return the bool value
return Taken;
}