Ejemplo n.º 1
0
        private SqlParameter buildOutputParameter(proceTuple pt)
        {
            SqlParameter sqlParam = new SqlParameter(pt.ParamName, getSqlDbType(pt.TypeName), pt.TypeLegnth);

            sqlParam.Direction = ParameterDirection.Output;
            return(sqlParam);
        }
Ejemplo n.º 2
0
        // 全部都上
        public void execProcedure(string ProcedureName, ArrayList paramList, ArrayList outValueList, proceTuple returnValue)
        {
            conn.Open();

            _inputProcList  = paramList;
            _outputProcList = outValueList;
            _returnProc     = returnValue;

            using (SqlCommand cmd = new SqlCommand())
            {
                cmd.CommandText = ProcedureName;
                cmd.CommandType = CommandType.StoredProcedure;

                for (int i = 0; i < _inputProcList.Count; i++)
                {
                    cmd.Parameters.Add(buildInputParameter(_inputProcList[i] as proceTuple));
                }

                for (int i = 0; i < _outputProcList.Count; i++)
                {
                    cmd.Parameters.Add(buildOutputParameter(_outputProcList[i] as proceTuple));
                }

                SqlParameter sqlParam = new SqlParameter(_returnProc.ParamName, getSqlDbType(_returnProc.TypeName), _returnProc.TypeLegnth);
                sqlParam.Direction = ParameterDirection.ReturnValue;
                cmd.Parameters.Add(sqlParam);

                cmd.ExecuteNonQuery();
            }

            conn.Close();
            return;
        }
Ejemplo n.º 3
0
        private SqlParameter buildInputParameter(proceTuple pt)
        {
            SqlParameter sqlParam = new SqlParameter(pt.ParamName, getSqlDbType(pt.TypeName), pt.TypeLegnth);

            sqlParam.Value = pt.inputData;

            return(sqlParam);
        }