Tina's blog
开心过好每一天! Come on !
 

    1.public static SqlParameter MakeParam(string ParamName, SqlDbType DbType, Int32 Size, ParameterDirection Direction, object Value)
    {
        SqlParameter param;

        if (Size > 0)
            param = new SqlParameter(ParamName, DbType, Size);
        else
            param = new SqlParameter(ParamName, DbType);

        param.Direction = Direction;
        if (!((Direction == ParameterDirection.Output || Direction == ParameterDirection.ReturnValue) && Value == null))
        {
            param.Value = Value;
        }

        return param;
    }

   2.使用

        SqlParameter[] sqlPrm ={
            new SqlParameter("@memberID", userID),
            new SqlParameter("@appID", appID),
            new SqlParameter("@Type", type),
            new SqlParameter("@Name", name),
            Util.MakeParam("@IsDuplicate",SqlDbType.Bit,1,ParameterDirection.Output,null)
        };

posted on 2008-08-15 16:31  Tinachang  阅读(681)  评论(0编辑  收藏  举报