Example #1
0
 /// <summary>
 /// 将SqlParameter类型转换为CmdParameter
 /// </summary>
 /// <param name="prams"></param>
 /// <returns></returns>
 private CmdParameter[] RecoverOraParameter(OracleParameter[] prams)
 {
     if (prams == null)
     {
         return(null);
     }
     CmdParameter[] sqlPrams = new CmdParameter[prams.Length];
     try
     {
         for (int i = 0; i < prams.Length; i++)
         {
             CmdParameter sqlPram = new CmdParameter(prams[i].ParameterName, prams[i].Value);
             sqlPrams[i] = sqlPram;
             //sqlPrams[i].Direction =  prams[i].Direction.ToString();// ParameterDirection.Output;
         }
     }
     catch (Exception ex)
     {
         CFunctions.HandleException(System.Reflection.MethodBase.GetCurrentMethod().Name, ex);
     }
     return(sqlPrams);
 }
Example #2
0
        public static CmdParameter[] RecoverParameter(object[] prams)
        {
            if (prams == null)
            {
                return(null);
            }
            CmdParameter[] sqlPrams = new CmdParameter[prams.Length];
            try
            {
                for (int i = 0; i < prams.Length; i++)
                {
                    if (prams[i] is SqlParameter)
                    {
                        CmdParameter sqlPram = new CmdParameter((prams[i] as SqlParameter).ParameterName, (prams[i] as SqlParameter).Value);
                        sqlPrams[i] = sqlPram;
                    }
                    else if (prams[i] is OracleParameter)
                    {
                        CmdParameter sqlPram = new CmdParameter((prams[i] as OracleParameter).ParameterName, (prams[i] as OracleParameter).Value);
                        sqlPrams[i] = sqlPram;
                    }
                    else if (prams[i] is MySqlParameter)
                    {
                        CmdParameter sqlPram = new CmdParameter((prams[i] as MySqlParameter).ParameterName, (prams[i] as MySqlParameter).Value);
                        sqlPrams[i] = sqlPram;
                    }

                    //sqlPrams[i].Direction =  prams[i].Direction.ToString();// ParameterDirection.Output;
                }
            }
            catch (Exception ex)
            {
                CFunctions.HandleException(System.Reflection.MethodBase.GetCurrentMethod().Name, ex);
            }
            return(sqlPrams);
        }