草庐IT

is_active

全部标签

c# - "Cannot insert explicit value for identity column in table when IDENTITY_INSERT is set to OFF"带复合键

我们最近向我们的数据库添加了一个新的“级别”——在整个数据库中的表中现有ID身份字段的上方/之前添加了一个键“Company_ID”。例如,如果一个表有ID然后是字段,它现在有Company_ID,然后是ID,然后是字段。这个想法是,这允许ID为提供给功能的每个不同的Company_ID值自动递增(Company_ID1可以有ID1、2、3等;Company_ID2可以有ID1、2、3等)。自增字段保持为ID。一个示例表是:[dbo].[Project]([Company_ID][int]NOTNULL,[ID][int]IDENTITY(1,1)NOTNULL,[DescShort]

c# - 验证错误 : The value 'on' is not valid for <<property name>>

在我的项目中,我有一个模型,您可以在这里看到我模型的一部分:publicclassCheckoutModel{publicboolOtherPlace{get;set;}[RequiredIf("OtherPlace",true,ErrorMessage="")]publicstringOtherPlaceFullName{get;set;}[RequiredIf("OtherPlace",true,ErrorMessage="")]publicintOtherPlaceProvinceId{get;set;}[RequiredIf("OtherPlace",true,ErrorMes

C# 短错误 : Negating the minimum value of a twos complement number is invalid

我在我的项目中遇到过这个错误,该项目涉及使用数字音频信号。所以我一直在获取振幅值,最近遇到了这个错误。调试时遇到的振幅值为“-32768”时会出现这种情况。我将这些值存储在一个short[]数组中。我有一种预感,它与最大值/最小值有关(我使用Math.Abs​​),但我不确定如何处理它。有人可以帮忙吗?谢谢! 最佳答案 16位有符号整数(short)取值介于-32,768和32,767之间。在16位有符号整数中不可能对-32768求反或获取绝对值。该值(32,768)大于最大可能的正值(32,767)。在不了解您正在使用的算法的更多

c# - 通过 .net 获取 Active Directory 组中的用户名

下面的代码让我获得了组中的用户,但它被返回了“CN=johnson\,Tom,OU=Users,OU=Main,DC=company,DC=com”我只想返回名字和姓氏。我怎样才能做到这一点?DirectoryEntryou=newDirectoryEntry();DirectorySearchersrc=newDirectorySearcher();src.Filter=("(&(objectClass=group)(CN=Gname))");SearchResultres=src.FindOne();if(res!=null){DirectoryEntrydeGroup=newDi

c# - 我可以将 Activator.CreateInstance 与接口(interface)一起使用吗?

我有一个例子:Assemblyasm=Assembly.Load("ClassLibrary1");Typeob=asm.GetType("ClassLibrary1.UserControl1");UserControluc=(UserControl)Activator.CreateInstance(ob);grd.Children.Add(uc);我正在创建类的实例,但是如何创建实现某个接口(interface)的类的实例?即UserControl1实现了ILoad接口(interface)。U:我可以稍后将对象转换为接口(interface),但我不知道程序集中的哪个类型实现了该接

c# - 如何调整 "is a type but is used like a variable"?

我正在尝试在网络服务中生成一些代码。但它返回了2个错误:1)List是一种类型,但像变量一样使用2)方法“Customer”没有重载接受“3个参数”[WebService(Namespace="http://tempuri.org/")][WebServiceBinding(ConformsTo=WsiProfiles.BasicProfile1_1)][ToolboxItem(false)]publicclasswstest:System.Web.Services.WebService{[WebMethod]publicListGetList(){Listli=List();li.A

c# - 具有私有(private)密封类的 Activator.CreateInstance

我正在尝试新建一个LocalCommand实例,它是System.Data.SqlClient.SqlCommandSet的私有(private)类。我似乎能够很好地获取类型信息:AssemblysysData=Assembly.Load("System.Data,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089");localCmdType=sysData.GetType("System.Data.SqlClient.SqlCommandSet+LocalCommand");但是当我尝试实例化Activat

c# - OOPS 概念 : What is the difference in passing object reference to interface and creating class object in C#?

我有一个类CustomerNew和一个接口(interface)ICustomer:publicclassCustomerNew:ICustomer{publicvoidA(){MessageBox.Show("Classmethod");}voidICustomer.A(){MessageBox.Show("Interfacemethod");}publicvoidB(){MessageBox.Show("ClassMethod");}}publicinterfaceICustomer{voidA();}我对这两行代码很困惑。ICustomerobjnew=newCustomerNe

c++-cli - C++/CLI-问题: Is there an equivalent to the C# "is" keyword or do I have to use reflection?

我在MSDN的某个地方读到过,与C#的“is”关键字等效的是dynamic_cast,但这并不完全等效:它不适用于值类型或泛型参数。例如在C#中我可以写:voidMyGenericFunction(){objectx=...if(xisT)...;}如果我尝试“等效的”C++/CLI:genericvoidMyGenericFunction(){objectx=...if(dynamic_cast(x))...;}我收到编译器错误“errorC2682:cannotuse'dynamic_cast'toconvertfrom'System::Object^'to'T'”。我唯一能想到的

c# - "Inspecting the state of an object in the debuggee of type System.Reflection.MethodBase is not supported in this context"

我不知道这个错误是什么意思。我使用的是VisualStudioforMac7.5.0社区版。我在带有ASP.NETCore的EntityFramework中使用延迟加载。publicpartialclassAdminUser{publicAdminUser(){RoleAssign=newHashSet();}publicGuidUserId{get;set;}publicstringFirstName{get;set;}publicstringLastName{get;set;}publicstringEmail{get;set;}publicstringUserName{get;s