public static bool Exist(string username) { string cmd = "select count(1) from [settings] where username=@username"; SqlParameter[] p = new SqlParameter[] { new SqlParameter("username", SqlDbType.NVarChar, 50) }; p[0].Value = username; return((int)helper.QueryScalar(cmd, p) > 0); }
public static bool Exist(string name) { string cmd = "select count(1) from [PositionInfo] where username=@name"; SqlParameter[] p = new SqlParameter[] { new SqlParameter("name", SqlDbType.NVarChar, 50), }; p[0].Value = name; return((int)helper.QueryScalar(cmd, p) > 0); }
public static int GetCount(string where) { string cmd = "select count(1) from [Message] where " + where; return((int)helper.QueryScalar(cmd)); }