1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
public abstract class ClientDAO
{
private static SqlConnection _myConnect;
public static SqlConnection GetConnection()
{
if (_myConnect == null)
{
BddConnection mySocle = new BddConnection();
_myConnect = (SqlConnection)mySocle.GetConnection();
}
return _myConnect;
}
public static bool PseudoExist(string pseudo)
{
bool exist = false;
try
{
SqlCommand oSqlCommand = new SqlCommand("ps_PseudoExist", GetConnection());
oSqlCommand.CommandType = CommandType.StoredProcedure;
oSqlCommand.Parameters.Add("u_pseudo", SqlDbType.VarChar, 30).Value = pseudo;
GetConnection().Open();
int rowCount = Convert.ToInt32(oSqlCommand.ExecuteScalar());
GetConnection().Close();
if (rowCount > 0)
exist = true;
}
catch (Exception)
{
throw;
}
return exist;
}
} |
Partager