I have a database with 1 table that has 1 column that keeps of my file watcher. I want the user to be able to search for a file extension of their choice but am having a hard time getting it to work correctly. I can query for all file extensions, but when I try to use user input as a variable something seems to not be working correctly. (Also using wildcard character for searching). My issue is primarily only with the select statement.(Or so I think.)
string str = textBox1.Text.Trim();
query = "SELECT * FROM LOG WHERE ENTRY like '%@str%'";
using (SQLiteCommand cmd = new SQLiteCommand(query, conn))
{
using (SQLiteDataReader reader = cmd.ExecuteReader())
{
while (reader.Read())
{
listBox1.Items.Add((string) reader["ENTRY"]);
}
}
}