示例#1
0
        public int GetContactCountByGroupId(int groupId)
        {
            StringBuilder buffer = new StringBuilder();

            buffer.Append("select count(1) from Contact");
            buffer.Append(" where GroupId=@GroupId");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("@GroupId", OleDbType.Integer, 4)
            };
            parameters[0].Value = groupId;
            return(int.Parse(OleDbHelper.ExecuteScalar(buffer.ToString(), parameters).ToString()));
        }
示例#2
0
        public bool Login(string userName, string userPassword)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select count(1) from [User]");
            strSql.Append(" where UserName=@UserName and Password=@UserPassword");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("@UserName",     OleDbType.VarChar, 50),
                new OleDbParameter("@UserPassword", OleDbType.VarChar, 50),
            };
            parameters[0].Value = userName;
            parameters[1].Value = userPassword;
            int n = Convert.ToInt32(OleDbHelper.ExecuteScalar(strSql.ToString(), parameters));

            if (n == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }