c# - 为什么命令不能在 Windows XP 上运行?

标签 c# .net

我有一个 .NET 3.5 (C#) 应用程序,但有趣的是它不能在 Windows XP 上运行,但在 Windows 7 上运行良好。 我的代码是:

DataSet ds = new DataSet();

CmdData.FillDataSet(ref ds, "Select * from T_User");

bool admin = ds.Tables[0].Rows[0].Field<long>("Id") == 1;

错误发生在第三行并显示这个窗口

enter image description here

详细信息错误:

System.IO.FileNotFoundException: Could not load file or assembly 'System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.

当用下面的代码替换第三行时,我的应用没有错误:

bool admin = ds.Tables[0].Rows[0].ItemArray[0].ToString().Equals("1");

我不想使用这个命令,因为我需要字段的名称。

最佳答案

您的 xp 计算机上可能没有安装 .net 3.5。

关于c# - 为什么命令不能在 Windows XP 上运行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31368752/

相关文章:

C#:无法加载文件或程序集 'OpenPop, Version=2.0.4.369, Culture=neutral, PublicKeyToken=null' 或其依赖项之一

.net - 将 UPN 分配给 Azure Active Directory 应用程序注册

c# - 异步 protobuf 序列化

c# - 如何使包含 ItemsControl 的 WPF 网格具有相同大小的列

c# - 将整数转换为货币

asp.net - 如何在 HttpWebRequest 期间维护 session 值?

c# - 为什么 enum.ToString() 给出的结果与调试器工具提示中显示的结果不同?

.net - 为什么反编译 .NET IL 代码如此容易?

c# - 通过 C# 删除 SQL Server 数据库

C#哈希密码创建盐问题