I have table with columns something like this:
table(INT id, serial, data)
And I want to create following SELECT command:
SELECT * FROM table WHERE serial IN (list-of-serial)
But problem is that when I add more than one value into list-of-serial, I get empty query.
For example:
id serial
1 1234
2 5678
3 1234
4 9012
5 1234
6 5678
7 9012
SELECT * FROM table WHERE serial IN ('1234','9012')
In this form, it works, but I need to convert it into C# query.
string file="my-sqlite-database";
SQLiteConnection database = new SQLiteConnection($@"URI=file:{file}");
database.Open();
SQLiteCommand C = new SQLiteCommand("SELECT * FROM table WHERE serial IN (@serials)", database);
C.Parameters.AddWithValue("@serials","('1234','9012')");
C.Prepare();
SQLiteDataReader R = C.ExecuteReader();
While(R.Read()){} // 0 rows
What am I doing wrong? I have tried passing string arrays, string with and without quotes, no difference.
('1234','9012')