表名: Settings

查询指定列的指定值

查询 属性名 这列 名为 CurrentGroupName这条记录的 属性值 对应的值是什么?

        string ConnectionString = "Data Source = test.db; Version=3;";
        string sql = $"Select 属性值 From Settings Where 属性名= 'CurrentGroupName'";

        using (SQLiteConnection conn = new SQLiteConnection(ConnectionString)) {
            using (SQLiteCommand cmd = new SQLiteCommand(sql,conn)) {
                conn.Open();
                object obj = cmd.ExecuteScalar();
                MessageBox.Show((string)obj); 
            }
        }

因为我只读指定一一行对应的值所以使用ExecuteScalar



遍历的方法如下:

https://www.cnblogs.com/Donnnnnn/p/6023421.html

相关文章:

  • 2021-07-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-26
  • 2021-07-13
  • 2022-02-22
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-02-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案