1
我想检查一个名为isSolved的表项的布尔型字段。然后编写一个依赖于布尔值运行代码的if条件。检查SQLite表项字段 - C#WPF
我已经试过这种方法:
foreach (int level in builtInLevels2)
{
myImage = new Image();
int levelNowInt = level;
string levelName = "Level " + level;
SQLiteConnection sqlConnection;
SQLiteCommand sqlite_cmd;
try
{
// create a new database connection:
sqlConnection = new SQLiteConnection(dbConnectionString);
// open the connection:
sqlConnection.Open();
// create a new SQL command:
sqlite_cmd = sqlConnection.CreateCommand();
sqlite_cmd.CommandText = "select isSolved from Level where name = " + "'" + levelName + "'" + ";";
var dbEntry = sqlite_cmd.ExecuteNonQuery();
MessageBox.Show(dbEntry.ToString());
}
VAR dbEntry始终是0。然而,这不是一个布尔值,为表项的布尔值在某些情况下,实际上1。我如何正确地做到这一点?
谢谢,它的工作原理。 – user2602079