Skip to content

Commit

Permalink
Fixed null parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
RikuVirtanen committed Feb 12, 2024
1 parent 3bfc129 commit 87214c4
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ public static async Task<Result> ExecuteQueryToFile([PropertyTab] Input input, [
{
foreach (var parameter in input.QueryParameters)
{
if (parameter.Value is null)
parameter.Value = DBNull.Value;

if (parameter.SqlDataType is SqlDataTypes.Auto)
{
command.Parameters.AddWithValue(parameterName: parameter.Name, value: parameter.Value);
}
else
{
if (parameter.Value is null)
parameter.Value = DBNull.Value;

var sqlDbType = (SqlDbType)Enum.Parse(typeof(SqlDbType), parameter.SqlDataType.ToString());
var commandParameter = command.Parameters.Add(parameter.Name, sqlDbType);
commandParameter.Value = parameter.Value;
Expand Down

0 comments on commit 87214c4

Please sign in to comment.