By adding a parameter to the query, the error raised on the DB.Fill(DS) line.
The parameter @id is exactly equal to the parameter of the query.
I've search a lot but all solution is about typo of parameter name.
SQLiteDataAdapter DB;
DataSet DS = new DataSet();
DataTable DT = new DataTable();
SetConnection();
sqlCmd = sqlCon.CreateCommand();
string CommandText = "select * from Words where id = @id"; //query;
await sqlCon.OpenAsync();
sqlCmd.Parameters.AddWithValue("@id", 1);
DB = new SQLiteDataAdapter(CommandText, sqlCon);
DS.Reset();
await Task.Run(() => { DB.Fill(DS); });
DT = DS.Tables[0];
sqlCon.Close();
return DT;
UPDATE = Solution As @steve16351 said, the problem is with CommandText. Just add the query to sqlCmd and send it as SQLiteDataAdapter parameter.
sqlCmd = sqlCon.CreateCommand();
sqlCmd.CommandText("select * from Words where id = @id"); //query; <<==
await sqlCon.OpenAsync();
sqlCmd.Parameters.AddWithValue("@id", 1);
DB = new SQLiteDataAdapter(sqlCmd); <<==