c# - 从 msi 文件中选择行的问题
问题描述
我编写了一个配置工具来轻松配置我使用 Visual Studio 安装项目创建的 msi 安装程序。我成功地编辑了表格中的条目InstallExecuteSequence
。现在我也想更改Control
表中的某些内容,但选择查询返回 0 个条目。
using (Database db = new Database(path, DatabaseOpenMode.Transact))
{
using (var vw = db.OpenView(db.Tables["Control"].SqlSelectString))
{
vw.Execute();
Record record = vw.Fetch(); // <= this always returns null
while (record != null)
{
record = vw.Fetch();
if (record == null)
break;
if (record["Dialog_"].ToString().ToLower().Contains("CustomCheckA") && record["Control"].ToString().ToLower().Contains("Text"))
{
tbName.Text = record["Text"].ToString();
}
if (record["Dialog_"].ToString().ToLower().Contains("CustomCheckA") && record["Control"].ToString().ToLower().Contains("BodyText"))
{
tbDescription.Text = record["Text"].ToString();
}
}
if (String.IsNullOrEmpty(eintrag.IDString))
MessageBox.Show("This file does not contain the searched keywords");
vw.Close();
}
db.Close();
}
解决方案
我相信你需要添加更多关于你想要的结果的信息,但我在这里看到了一些东西。
if (record["Dialog_"].ToString().ToLower().Contains("CustomCheckA")
您将其转换为小写,然后检查是否包含该单词,但该单词并非全部小写。所以结果总是错误的。
推荐阅读
- sql - 如何通过 sql server express 连接 AWS sql server
- sql - AWS Athena (Presto) 偏移支持
- android - 当您更改并返回成绩选项卡时如何刷新选项卡式活动?
- ios - 无法分配给属性:“宽度”是仅获取属性
- javascript - 解析:ParseError { 代码:101,消息:'找不到对象。' }
- cassandra - 是否有一种惯用的方式将客户端版本控制到数据库?
- c# - 如何在 saveChanges() 中获取错误的实体
- javascript - 当有一个内部循环时,地图没有返回数组
- macos - Mac 安装程序覆盖文件的所有副本
- python - 如何将 DjangoRestFramework permissin_classes 关系设置为“或”?