public ActionResult Index() { var strE = Encr_Decr.Encrypt("data source=DESARROLLOVILA;initial catalog=OIGAME_CONSULTORES_Test;user id=sa;password=TURjvb/2014;MultipleActiveResultSets=True;App=EntityFramework"); var dec = Encr_Decr.Decrypt(strE); return(View()); }
public static DataTable selectQuery2(SqlCommand command, string database) { try { DataTable datatable = new DataTable(); int resul = int.MinValue; SqlTransaction transaction = default(SqlTransaction); SqlConnection connection = new SqlConnection(); connection.ConnectionString = Encr_Decr.Decrypt(System.Configuration.ConfigurationManager.ConnectionStrings["ModelPazYSalvo"].ConnectionString); if (command.CommandText.Contains(" ")) { command.CommandType = CommandType.Text; } else { command.CommandType = CommandType.StoredProcedure; } connection.Open(); transaction = connection.BeginTransaction("New select Transaction"); try { command.Connection = connection; command.Transaction = transaction; SqlDataAdapter dataAdapter = new SqlDataAdapter(command); dataAdapter.Fill(datatable); transaction.Commit(); connection.Close(); } catch (Exception ex) { transaction.Rollback(); throw; } finally { connection.Dispose(); } return(datatable); } catch (Exception ex) { throw new Exception(ex.Message); } }