diff --git a/DBInteraction.cs b/DBInteraction.cs index 572918b..4d27355 100644 --- a/DBInteraction.cs +++ b/DBInteraction.cs @@ -14,7 +14,7 @@ namespace CryptoCalc { if (data is null) { - throw new ArgumentNullException(nameof(data)); + throw new ArgumentNullException(nameof(data), "No data passed to SQL"); } using IDbConnection cnn = new SQLiteConnection(Util.GetConnectionString(data.DBName)); @@ -25,26 +25,14 @@ namespace CryptoCalc public class GenericDB where T : DBClasses { - - public IEnumerable LoadAllData(T data) + public IEnumerable QueryData(T data, string query) { - if (data.DBTableName is null) + if (data is null) { - throw new ArgumentNullException(nameof(data.DBTableName)); + throw new ArgumentNullException(nameof(data), "DBclass is null"); } using IDbConnection _connection = new SQLiteConnection(Util.GetConnectionString(data.DBName)); - return _connection.Query($"select * from {data.DBTableName}", new DynamicParameters()); - } - - public IEnumerable QueryData(T data, string query) - { - if (data.DBTableName is null) - { - throw new ArgumentNullException(nameof(data.DBTableName)); - } - - using IDbConnection _connection = new SQLiteConnection(Util.GetConnectionString(data.DBTableName)); return _connection.Query($"{query}", new DynamicParameters()); } } diff --git a/MainWindow.xaml b/MainWindow.xaml index a369759..02c105a 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -14,7 +14,7 @@