Skip to content

人大金仓数据库使用InsertOrUpdateDict出错 #1880

@hellosnowy

Description

@hellosnowy

问题描述及重现代码:

##问题描述

System.ArgumentNullException: Value cannot be null. (Parameter 'source')\r\n   at System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)\r\n   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source)\r\n   at FreeSql.PostgreSQL.Curd.OnConflictDoUpdate`1..ctor(IInsert`1 insert, Expression`1 columns)\r\n   at FreeSql.PostgreSQL.Curd.PostgreSQLInsertOrUpdate`1.<>c__DisplayClass1_0.<ToSql>g__getInsertSql|2(List`1 data, Boolean flagInsert, Boolean noneParameter)\r\n   at FreeSql.PostgreSQL.Curd.PostgreSQLInsertOrUpdate`1.<>c__DisplayClass1_0.<ToSql>b__0(List`1 a)\r\n   at System.Linq.Enumerable.SelectArrayIterator`2.MoveNext()\r\n   at System.String.Join(String separator, IEnumerable`1 values)\r\n   at FreeSql.PostgreSQL.Curd.PostgreSQLInsertOrUpdate`1.ToSql()\r\n   at FreeSqlGlobalExtensions.InsertOrUpdateDictImpl.ToSql()\r\n " 
// c# code

###重现代码

var dic = new Dictionary<string, object>();
dic.Add("id", 1);
dic.Add("name", "xxxx");


  IFreeSql freeSql= new FreeSql.FreeSqlBuilder()    .UseConnectionString(DataType.KingbaseES,Server=127.0.0.1;Port=54321;UID=test;PWD=111111;database=test;MAXPOOLSIZE=30)
    .UseMonitorCommand(cmd => Console.WriteLine($"{cmd.CommandText}\r\n"))//监听SQL语句
    .UseQuoteSqlName(true)
    .UseNoneCommandParameter(true)
    .Build();
var sql =freeSql.InsertOrUpdateDict(dic ).AsTable(tb_test).ToSql();
freeSql.InsertOrUpdateDict(dic ).AsTable(tb_test).ExecuteAffrows();
// c# code

数据库版本

人大金仓-v8r6

安装的Nuget包

.net framework/. net core? 及具体版本

.net6

尝试使用KingbaseES、PostgreSQL协议分别调用,都报上述错误,数据表名加不加模式(默认采用public)一样的问题,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions