You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What operating system and processor architecture are you using?
Windows 11, Azure windows latest
What version of .NET framework are you using?
.NET 8 in-process
What did you do?
I have a stored procedure that accepts 2 variables, the first is a guid, the second is a date, the third is a string.
Parameters are added like this:
SqlParameter[] sqlParameters = [ new SqlParameter("MYGUID", pumpRequest.BatchUid), new SqlParameter("MYDATE", pumpRequest.LookBackDate), new SqlParameter("MYSTRING", pumpRequest.StateAbbrev) ];
In this case, MYGUID contains a Guid and MYDATE and MYSTRING are null
But even though the DATE is null, it appears that the code tries to convert the value to an int and I'm getting the following error:
System.NullReferenceException HResult=0x80004003 Message=Object reference not set to an instance of an object. Source=Snowflake.Data StackTrace: at Snowflake.Data.Client.SnowflakeDbCommand.convertToBindList(List1 parameters)
`
What did you expect to see?
The stored procedure, would receive the null DATE field and query would execute as expected.
It appears that it needs a null check before going into this code block.
Can you set logging to DEBUG and collect the logs?
I can, but I'm not going to post this on a public website.
The text was updated successfully, but these errors were encountered:
github-actionsbot
changed the title
Cannot pass null into a stored procedure to nullable DATE field
SNOW-1917621: Cannot pass null into a stored procedure to nullable DATE field
Feb 7, 2025
What version of .NET driver are you using?
4.01
What operating system and processor architecture are you using?
Windows 11, Azure windows latest
What version of .NET framework are you using?
.NET 8 in-process
What did you do?
I have a stored procedure that accepts 2 variables, the first is a guid, the second is a date, the third is a string.
Parameters are added like this:
SqlParameter[] sqlParameters = [ new SqlParameter("MYGUID", pumpRequest.BatchUid), new SqlParameter("MYDATE", pumpRequest.LookBackDate), new SqlParameter("MYSTRING", pumpRequest.StateAbbrev) ];
In this case, MYGUID contains a Guid and MYDATE and MYSTRING are null
But even though the DATE is null, it appears that the code tries to convert the value to an int and I'm getting the following error:
System.NullReferenceException HResult=0x80004003 Message=Object reference not set to an instance of an object. Source=Snowflake.Data StackTrace: at Snowflake.Data.Client.SnowflakeDbCommand.convertToBindList(List
1 parameters)`
The stored procedure, would receive the null DATE field and query would execute as expected.
It appears that it needs a null check before going into this code block.
I can, but I'm not going to post this on a public website.
The text was updated successfully, but these errors were encountered: