I'm trying to write function like this below to Insert records to table in my data base. I'm using SQLite for this. I have a problem in this 3 lines:
insertSQL.Parameters.Add(newUser.Username);
insertSQL.Parameters.Add(newUser.Password);
insertSQL.Parameters.Add(newUser.Email);
The content of errors:
Error CS1061 'SQLiteCommand' does not contain a definition for >'Parameters' and no accessible extension method 'Parameters' accepting a >first argument of type 'SQLiteCommand' could be found (are you missing a >using directive or an assembly reference?)
I have usings like "using SQLite; using static SQLite.SQLiteCommand;" The Microsoft docs and many guides are including property "Parameters" and similar code.
public static SQLiteConnection non_async_db;
public void AddUser(User newUser, string login, string password, string email)
{
SQLiteCommand insertSQL = new SQLiteCommand(non_async_db);
insertSQL.CommandText = "INSERT INTO User(Username, Password, Email) VALUES(" + login + ", " + password + ", " + email + ")";
insertSQL.Parameters.Add(newUser.Username);
insertSQL.Parameters.Add(newUser.Password);
insertSQL.Parameters.Add(newUser.Email);
}
I have no idea where the problem is. Maybe this way is outdated or simply wrong?