-
Notifications
You must be signed in to change notification settings - Fork 292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SQLDataAdapter.FillSchema doesn't mark computed columns as readonly #275
Comments
@Lohnegrim I'm having trouble reproducing the expected behaviour is .NET Framework (I'm using 4.7.1). The ReadOnly property of sMemo is False even though I'm using .NET Framework. I tried with both Microsoft.Data.SqlClient versions 1.0.19269.1 and the latest one built from the current master branch, but both of them give me False. Is there anything missing from the repro code what I should be aware of? I noticed in the repro steps the InsertCommand is computed but never used in the code. Is it supposed to be used somewhere by sqlDataAdapter? |
@v-kaywon
Sorry My mistake, seems like Microsoft.Data.SqlClient always returns readonly: False, it only returnes true on System.Data.SqlClient, and on the .Net Framework. |
This was a regression caused by PR dotnet/corefx#34393 which caused this issue. I have been able to narrow down to the change which caused the issue, but haven't looked into why the issue was caused. |
col.ReadOnly cannot be set, it is derived from col.Updatability and col.UpdatabilityUnknown. @Wraith2 had changed the SqlMetaData to use flags. I feel there is a bug in the computation of |
@Lohnegrim Attached is the driver with the fix in PR #286. Can you try it out? Thanks! |
@v-kaywon yes, this works. |
So i stumbled over this Problem right now. |
Unlikely. Microsoft.Data.SqlClient supercedes System.Data.SqlClient. You should look into changing your project to use the new library. |
@BenKmann what is preventing you from using Microsoft.Data.SqlClient ? |
Most of our Base-Code-Libraries are for .NET Framework, which only use .NET Framework SQL-Client. But in the future we will Upgrade to Microsoft.Data.SqlClient. But this will take some time, to migrate even the .NET Framework Projects. |
Ah ok it is broken since 4.7.0, so if i use System.Data.SqlClient 4.6.1 i have a working SqlClient. |
@BenKmann note that Microsoft.Data.SqlClient supports .NET Framework - you don't have to stay on System.Data.SqlClient just because a project targets .NET Framework. |
Describe the bug
The Function SQLDataAdapter.FillSchema redurns the shema of a table, witch sets the ReadOnly Property of computed columns correcntly on the .Net Framework, but not in .Net Core.
To reproduce
Create a new VB.NET Project and add a reference to the NuGet Package 'Microsoft.Data.SqlClient'.
Add this Code to the Sub Main:
Expected behavior
Using the System.Data.SQLClient
The .Net Framework Returns the Line:
But on .Net Core it returns:
Using the Microsoft.Data.SQLClient
booth return:
Also only when using System.Data.SQLclient on the .Net Framework you will get this working SQLCommand for the Insert command:
the Other tree compinations return:
resulting it this Error if you try to use it:
to reporduce you have to add this Coe after the Line 'Console.WriteLine(cmd.CommandText);':
Further technical details
Microsoft.Data.SqlClient version: 1.0.19269.1
.NET target: Framework 4.7.1 (Correct), Core 3.0.0 (Wrong)
SQL Server version: SQL Server 2017
Operating system: Windows 10 (1809)
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: