Open JordHendriks opened 1 year ago
@JordHendriks thanks for opening the issue. we will look into this.
Does it fail only for the highlighted query or any other query fails as well? If only fails for this query can you provide the create command for the database please?
It is only the highlighted query. The others do not fail. I added a print message in between every line and it works up until the line mentioned above.
@JRahnama I am using SQL server 2022 configuration manager and SQL server management studio 2019. Might not have been clear in my description.
I apologize, you asked me to send the create command of the database. CREATE TABLE [SQLFromPLC].[dbo].[PLC_CL0100010] (S1_Value bit, S2_Value bit, S3_Value bit, S4_Value bit, M1_Value bit, M2_Value bit, M3_Value bit, M4_Value bit, Dir1_Value bit, Dir2_Value bit, Dir3_Value bit, Dir4_Value bit, Timestamp datetime);
This is the table I created. I have tried several things but the error in C# looks like it occurs at the SqlDataReader reader = command.ExecuteReader() where command is getting the System.NullReferenceException.
I will test and will update you later.
Describe the bug
When debugging, i receive an error on line: SqlDataReader reader = command.ExecuteReader(). Using microsoft.data.sqlclient with the provided code, i try to connect with my sql database. All details are correctly filled but this exception keeps happening.
To reproduce
Include a complete code listing (or project/solution) that we can run to reproduce the issue.
Partial code listings, or multiple fragments of code, will slow down our response or cause us to push the issue back to you to provide code to reproduce the issue.
Expected behavior
When using System.data.SqlClient everything works as it should but I need to use the microsoft one because it is not outdated. When debugging, I expect the code to read from this database and show me all the values in the tables.
Further technical details
Microsoft.Data.SqlClient version: (found on the nuget or Microsoft.Data.SqlClient.dll) both options do not work for me. .NET target: (Framework 6.0) SQL Server version: (SQL Server 2022) Operating system: (Windows 10 2023)
Additional context SQLTest.zip