Beispiel #1
0
        public static void AddParameter(this List <SqlDBParameter> parameters, string parameterName, object value, SqlDBType dbType, ParameterDirection parameterDirection = ParameterDirection.Input)
        {
            var param = new SqlDBParameter();

            param.DBType        = dbType;
            param.Direction     = parameterDirection;
            param.ParameterName = parameterName;
            param.Value         = !value.IsNullOrEmpty() ? value : null;
            parameters.Add(param);
        }
Beispiel #2
0
        public static void AddParameter(this List <SqlDBParameter> parameters, string parameterName, object value, ParameterDirection parameterDirection, int size)
        {
            var param = new SqlDBParameter();

            param.DBType        = SqlDBType.None;
            param.Direction     = parameterDirection;
            param.ParameterName = parameterName;
            param.Size          = size;
            param.Value         = !value.IsNullOrEmpty() ? value : null;
            parameters.Add(param);
        }
Beispiel #3
0
        public static void AddParameter(this List <SqlDBParameter> parameters, string parameterName, object value, ParameterDirection parameterDirection = ParameterDirection.Input)
        {
            var param = new SqlDBParameter();

            param.DBType        = SqlDBType.None;
            param.Direction     = parameterDirection;
            param.ParameterName = parameterName;
            param.Size          = (parameterDirection == ParameterDirection.Output || parameterDirection == ParameterDirection.InputOutput) ? 2000 : 0;
            param.Value         = !value.IsNullOrEmpty() ? value : null;
            parameters.Add(param);
        }
Beispiel #4
0
 public static int GetValue(this SqlDBParameter parameter)
 {
     return(!parameter.Value.IsNullOrEmpty() ? Convert.ToInt32(Convert.ToString(parameter.Value)) : 0);
 }