sqlkata / querybuilder

SQL query builder, written in c#, helps you build complex queries easily, supports SqlServer, MySql, PostgreSql, Oracle, Sqlite and Firebird
https://sqlkata.com
MIT License
3.06k stars 499 forks source link

Issue in SQL Server - Unable to set null value to column in db #676

Open Krishna-Maiden opened 1 year ago

Krishna-Maiden commented 1 year ago

I have tried setting the null value like below map[keyValuePair.Key] = DBNull.Value;

but I am receiving exception 'The member p3 of type System.DBNull cannot be used as a parameter value'

if I dont add code, its saving as 'NULL' with string datatype.. which is wrong...

ahmad-moussawi commented 1 year ago

Can you post more details about what you are trying to achieve? and the database/SqlKata/dotnet version?

Krishna-Maiden commented 1 year ago

in react I am trying to set update value to Null in SQL Server through .NET.

var json = { test: '' } -- this will save empty string json = { test: null } -- this will save 'null' string.. my requirement is null value

using latest sql meta library for this

ahmad-moussawi commented 1 year ago

Sorry @Krishna-Maiden, this is not enough to explain the issue. Could you please post the minimum reproducible steps for your issue?

Krishna-Maiden commented 1 year ago

var student = { name: 'Arjun', gender: null }

in C# it is setting empty string for gender.. and saving empty for this column.