string sql = "SELECT column1 FROM table1 INNER JOIN table2 ON table1.table2ID = table2.table2ID where column1 = \"testData\"";
using (var command = new SqlCommand(sql, connection))
{
using (var reader = command.ExecuteReader())
{
while (reader.Read())
{
Console.WriteLine(reader["column1"].ToString());
}
Console.ReadLine();
}
}
上面的 SQL 查询在没有 where 子句并且我能够写行“testData”时工作正常。但是当我限制条件时,它给我 sqlException 说“testData”是一个无效的列?