Exemplo n.º 1
0
 public DataTable returnResult(string query, out string mensaje)
 {
     try
     {
         using (TdConnection cn = new TdConnection(conn.StringConnection))
         {
             cn.Open();
             TdCommand cmd = cn.CreateCommand();
             cmd.CommandText    = @query;
             cmd.CommandTimeout = 100000;
             TdDataAdapter adapter = new TdDataAdapter();
             adapter.SelectCommand = cmd;
             DataSet ds = new DataSet();
             adapter.Fill(ds);
             var dt = ds.Tables[0];
             mensaje = "Se consultaron " + dt.Rows.Count.ToString() + " registros.";
             return(dt);
         }
     }
     catch (Exception e)
     {
         mensaje = e.Message;
         return(null);
     }
 }
Exemplo n.º 2
0
        public bool doesWorkflowExist(String folder, String workflow)
        {
            String folder_name   = "'" + folder + "'";
            String workflow_name = "'" + workflow + "'";

            try
            {
                cn.Open();
                TdCommand cmd = cn.CreateCommand();
                cmd.CommandText = "SELECT count(*) from edw_auv_d.INFA_SESSION_LOG where subject_area = " + folder_name + " and workflow_name =" + workflow_name + ";";

                Int32 count = (Int32)cmd.ExecuteScalar();
                cn.Close();

                if (count > 0)
                {
                    return(true);
                }

                return(false);
            }catch (Exception ex)
            {
                cn.Close();
                MessageBox.Show(ex.Message);
                return(false);
            }
        }