我有一个 .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;
错误发生在第三行并显示这个窗口
详细信息错误:
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/