Esempio n. 1
0
        /// <summary>
        /// 把列转变为SqlParameter其中最后有@OrderId转出参数,可以用于存储过程
        /// </summary>
        /// <param name="columns"></param>
        /// <returns></returns>
        public static SqlParameter[] GetParameterByColumns(Column[] columns)
        {
            var par = new SqlParameter[columns.Length + 1];
            par[par.Length - 1] = MakeOutputParam("@OrderId", SqlDbType.Int, 4);
            for (int i = 0; i < columns.Length; i++)
            {
                Column parm = columns[i];
                par[i] = MakeInputParam(parm.ParameterName, parm.DbType, parm.Size, parm.Value);
            }

            return par;
        }
Esempio n. 2
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="tableName">表名称</param>
        /// <param name="columns">列名称 , 若为查询。则将该参数值为 null</param>
        /// <param name="whereColumns">条件</param>
        /// <param name="tableNameIsSubQuery">表名是否为一个子查询</param>
        public SqlCreator(string tableName, Column[] columns, Column[] whereColumns, bool tableNameIsSubQuery)
        {
            TableNameIsSubQuery = tableNameIsSubQuery;
            if (TableNameIsSubQuery)
            {
                TableName = tableName;
            }
            else
            {
                TableName = "[" + tableName + "]";
            }

            Columns = columns;
            WhereColumns = whereColumns;
        }
Esempio n. 3
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="tableName">表名称</param>
 /// <param name="columns">列名称</param>
 /// <param name="where">条件</param>
 public SqlCreator(string tableName, Column[] columns, Column where)
 {
     TableName = "[" + tableName + "]";
     Columns = columns;
     WhereColumns = new Column[1];
     WhereColumns[0] = where;
 }
Esempio n. 4
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="tableName">表名称</param>
 /// <param name="columns">列名称 , 若为查询。则将该参数值为 null</param>
 /// <param name="whereColumns">条件</param>
 public SqlCreator(string tableName, Column[] columns, Column[] whereColumns)
 {
     TableName = "[" + tableName + "]";
     Columns = columns;
     WhereColumns = whereColumns;
 }