Answer the question
In order to leave comments, you need to log in
Why doesn't the following Prepared query work?
For some reason, substitution in the following sql query does not work:
foreach (var table in existsInDBTables)
{
Console.WriteLine("------>{0}", table);
Console.ReadKey();
SQLiteConnection m_dbConnection = new SQLiteConnection("Data Source=" + config.SQLLitePath + ";Version=3;");
m_dbConnection.Open();
SQLiteCommand command = new SQLiteCommand(m_dbConnection);
command.CommandText = "SELECT 1 FROM @table LIMIT1";
command.Parameters.AddWithValue("@table", table);
command.Prepare();
Answer the question
In order to leave comments, you need to log in
You are trying to pass a table as a parameter. In my practice, this is not very possible.
In this case, I form a temporary hut on the server in the transaction, transfer it to the table and then do the required operations.
But now, looking at your code, I don’t really understand why to transfer the table to the server in order to make a SELECT from it by the server.
Maybe it's easier to use LINQ?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question