Ejemplo n.º 1
0
 /// <summary>
 /// 批量执行插入Sql
 /// </summary>
 /// <param name="str_msg"></param>
 /// <param name="arr2_values"></param>
 /// <param name="str_DbName"></param>
 /// <param name="arr_conditionName"></param>
 /// <returns></returns>
 private bool InsertBseDir(out string str_msg, List <string[]> arr2_values, string str_DbName, List <string> arr_conditionName)
 {
     try
     {
         List <string> arr_strSql = new List <string>();
         foreach (string[] arr_Tmp in arr2_values)
         {
             InsertClass _insertValues = new InsertClass();
             _insertValues.DbName         = str_DbName;
             _insertValues.arr_conditions = arr_conditionName;
             _insertValues.arr_values     = arr_Tmp.ToList();
             if (_insertValues.InsertOpr(out str_msg))
             {
                 arr_strSql.Add(str_msg);
             }
             else
             {
                 return(false);
             }
         }
         return(ExecOpr(out str_msg, arr_strSql));
     }
     catch (Exception ex)
     {
         str_msg = ex.Message;
         return(false);
     }
 }
Ejemplo n.º 2
0
 private bool InsertBseDir(out string str_msg, List <string[]> arr2_values, string str_DbName, List <string> arr_conditionName, ref List <string> str_keyid)
 {
     try
     {
         foreach (string[] arr_Tmp in arr2_values)
         {
             InsertClass _insertValues = new InsertClass();
             _insertValues.DbName         = str_DbName;
             _insertValues.arr_conditions = arr_conditionName;
             _insertValues.arr_values     = arr_Tmp.ToList();
             if (_insertValues.InsertOpr(out str_msg))
             {
                 try
                 {
                     _OraCon.Open();
                     DataSet _DataTmp = new DataSet();
                     string  str_cmd  = str_msg + ";";
                     str_cmd += "SELECT Seq from SQLITE_SEQUENCE where name = '" + str_DbName + "';";
                     OracleDataAdapter _adp = new OracleDataAdapter(str_cmd, _OraCon);
                     str_msg = _adp.Fill(_DataTmp).ToString();
                     if (_DataTmp != null && _DataTmp.Tables.Count > 0)
                     {
                         str_keyid.Add(_DataTmp.Tables[0].Rows[0][0] + "");
                     }
                     str_cmd = null;
                 }
                 catch (Exception ex)
                 {
                     str_msg = ex.Message;
                     return(false);
                 }
                 finally
                 {
                     _OraCon.Close();
                 }
             }
             else
             {
                 return(false);
             }
         }
         str_msg = str_keyid.Count().ToString();
         return(true);
     }
     catch (Exception ex)
     {
         str_msg = ex.Message;
         return(false);
     }
 }