嗨,我是C#编程的新手,刚刚从复制和粘贴了CLR函数,以便在Server 2012中使用它:
using System;
using System.Collections;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;
public class CustomFunctions
{
[
Microsoft.SqlServer.Server.SqlFunction
(
我试图让一个简单的基于Acumatica约定的SOAP API Get()或GetList()调用工作,但得到的结果是一个错误:
System.ServiceModel.FaultException:'System.ArgumentNullException:值不能为空,参数名: model
请参阅下面的代码。我首先尝试了REST API,但无法绕过不同的问题(我可能还会在另一篇文章中添加)。你知道这个错误是指什么吗?
using (var soapClient = new ServiceReference1.DefaultSoapClient())
{
//Log in to
我尝试使用此查询执行filter服务。
create proc usp_filter
@name VARCHAR(50),
@lastname VARCHAR(50),
@pass VARCHAR(50)
as
begin
SELECT * FROM tb_users
WHERE
(name = @name OR @name is null) AND
(lastname = @lastname OR @lastname is null) AND
(pass = @pass OR @pass is null)
end
go
它过滤表中的数据,但如果需要,它可以忽略部分或所有参数。
因此,当我在
我正在.net内核中创建web。我正在使用MacSiera10.12.3和visual为Mac版本7.3.3(build 12)。作为参考,我正在使用下面的Github项目。
Program.cs
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefa
我将为IDbConnection类调用Dapper扩展函数Query。问题是,它返回的一些值是数据库中的NULL。它一直在抱怨它们,所以我一直在将我的返回类的成员转换为可以为空的类型。但我在想,我可能最终会为几乎每个成员都这样做,因为数据通常是不完整的。这与使用DataRow类的旧代码不同,它能够将空值分配给我的返回类的string成员,而只使用ToString不会有任何问题。
public class ProductInfo
{
public Char Department { get; set; }
}
这是可行的:
ProductInfo myProduct = new Prod
我使用null表示函数的可选参数A? a应该假定非空默认值,在函数中计算。输入函数后,我将检查传入参数a是否为null,如果是,则为a分配一个非空值。从那时起,可以安全地假定a是非空的。问题是:编译器没有意识到这一点,现在我不得不在函数的其余部分引用a.Value,而不是简单的a。
有什么方法可以告诉编译器a实际上是非空的吗?如果不是,处理这些可选参数的最清晰方法是什么?
示例代码:
using System;
namespace test
{
public struct A { public int x; };
class Program
{
string to = "user@example.com";
string from = "user@example.com";
string title = "Test";
string body = "Test Email";
Type t1 = Type.GetType("System.Net.Mail.MailMessage");
Object test = Activator.CreateInstance(t1, new object[] { to, from, title, body });
我正在
我正在使用Visual中的TableAdapter查询配置向导编写以下SQL查询。
SELECT COUNT(*) AS census
FROM Inventory INNER JOIN Taxonomy ON Inventory.GlobalID = Taxonomy.GlobalID
WHERE (Inventory.Institution = @institution) AND (Inventory.Year = @year) AND
(Inventory.Nending > 0)
我试图在WHERE子句中添加以下条件:
(Taxonomy.Class = ISNULL(@
我试着把XmlReader读入XDocument
//GetContentStructureReader() retrieves the reader from an external source
XmlReader reader = GetContentStructureReader();
XDocument.Load(reader);
对于一个特定的数据源,我一直得到以下异常:
System.ArgumentNullException未被用户代码处理,Message=Value不能为空。参数名: value Source=System.Xml.Linq ParamName=value
我想使用.NET从Server计算现在和日期之间的日期差异。
我的目标是创建提供或阻止更新SQL行的条件。例如,如果datediff从现在到InsertDate(数据第一次输入Server的日期) <= 2,那么不要更新该行。
因此,我编写了代码,但它不工作,并返回此错误
System.ArgumentNullException:“值不能为空。Arg_ParamName_Name”。
我和你分享这个密码,希望你能帮我。
Dim oku As SqlDataReader
Dim datelimit As Long = DateAndTime.DateDiff(DateInterval
我有两个文件。需要从一个变量到另一个变量。在定义和填充它们的文件中,我将它们设置为全局的。但是在第二个文件中,当它读取变量时,它们是空的。我该如何解决这个问题?第一个文件中的代码:
public sealed partial class NewOrder : Page
{
public string Name1;
public string Mob;
public string Adres;
public string Email;
public string telephone;
public NewOrder()
{
static void X(String a,String b,String c)
{
TextBox textBox3 = new TextBox();
a = textBox3.Text;
if (a == " ")
{
throw new ArgumentNullException(a);
}
TextBox textBox4 = new TextBox();
var typeName = $"Drv{id}.Fonte";
var type = Type.GetType(typeName);
var myObject = Activator.CreateInstance(type);
Drv{id}是我的命名空间,Fonte是类名。
为什么'type‘总是空的?
当我打到第三行的时候,我就知道了:
System.ArgumentNullException:“值不能为空。”
我用的是EF核心2.2.4。
这是我的实体:
public class Person
{
public int? Id { get; set; }
public string Name { get; set; }
public string Surname { get; set; }
}
注意,Person有一个可空类型的主键。这似乎是由EF Core优雅地处理的,最终实体获得他们的Id;我使用了'nullable-type‘PK这个术语,而不是'nullable PK’,因为目的不是插入由数据库生成的空PK记录,而是正确地处理尚未为其生成键的实体的情况
我正在尝试执行以下查询
from st in _context.tbl_A
join ex in _context.tbl_B on st.ApplicantId equals ex.ApplicantId
join de in _contextCNS.tbl_C on st.DegreeId equals de.ID
where st.ApplicantId == AppId
执行查询时我会出错
System.ArgumentNullException:值不能为空。参数名称: Microsoft.EntityFrameworkCore.Utilities.Check.No
在我使用graphql-dotnet的项目中,我意外地开始收到DataLoader上下文为空的错误: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[1]
An unhandled exception has occurred while executing the request.
System.ArgumentNullException: Value cannot be null.
Parameter name: context
at GraphQL.DataLoader.DataLoaderContextExt
我对EF和.NET Core都很陌生,但通过使用一个工作项目,我能够构建Core2.0WebAPI解决方案。唯一的问题是我无法让实体框架在启动时实例化。我收到一个错误声明:
System.ArgumentNullException:值不能为空。参数名称: connectionString
我的Startup.cs文件:
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IC
我有一个强类型的配置工作,但是我很难在“类启动”中使用强类型的类。
下面是我在启动时的代码:
public class Startup
{
public IConfiguration Configuration { get; }
public Startup(IHostEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsetti