public static void ExcSql(string Intrusion) { try { C_Conex_Sql.Conex(1); //esto es para validar que la conexion no se abra si ya lo estas SqlCommand ComandoSQL = new SqlCommand { Connection = C_Conex_Sql.SqlCon(), CommandType = CommandType.Text, Transaction = C_Conex_Sql.TransSql, CommandText = Intrusion }; ComandoSQL.ExecuteNonQuery(); OcError = false; } catch (Exception E) { OcError = true; LogError("ExcSql " + E.ToString()); } finally { C_Conex_Sql.Conex(2); } }
public static DataTable ExcSqlDT(string Intrusion) { DataTable DT = new DataTable(); try { C_Conex_Sql.Conex(1); SqlDataAdapter Adaptador = new SqlDataAdapter(Intrusion, C_Conex_Sql.SqlCon()); Adaptador.Fill(DT); OcError = false; } catch (Exception E) { OcError = true; LogError("ExcSqlDT " + E.ToString() + Intrusion); } finally { C_Conex_Sql.Conex(2); } return(DT); }