Dear all
I have following function:
But I get an error, which is as follows:
Is there somebody here who can give me a tip on where to search the mistake and maybe a hint about how to solve it? I don't find the issue and it doesn't help that I don't have an overview of the code- since I am blind.
Thanks in advance for the possible replies.
Regards, Jordy
I have following function:
public ArrayList GetAllRows(string tablename) { // Set database object SQLiteConnection db = new SQLiteConnection(this.constr); db.Open(); // Execute SQL string sql = $"SELECT * FROM {tablename};"; SQLiteCommand cmd = new SQLiteCommand(sql, db); // Go through received data SQLiteDataReader reader = cmd.ExecuteReader(); // Add list to contain rows ArrayList rows = new ArrayList(); int row_count = 0; // set integer to count the rows of the selected query while (reader.Read() == true) { row_count = row_count + 1; } List<string> row = new List<string>(); while (reader.Read() == true) { foreach(string colname in this.GetColumns(tablename)) { string col = Convert.ToString(colname); row.Add(reader[col]); } rows.Add(row); } db.Close(); return rows; }
But I get an error, which is as follows:
Severity Code Description Project File Line Suppression State
Error CS1503 Argument 1: cannot convert from 'object' to 'string' DbActions C:\Users\jordy\source\repos\sqlexplo\DbActions\DbAction.cs 84 Active
Is there somebody here who can give me a tip on where to search the mistake and maybe a hint about how to solve it? I don't find the issue and it doesn't help that I don't have an overview of the code- since I am blind.
Thanks in advance for the possible replies.
Regards, Jordy