dotnet / dotnet/winforms

Dataset is using System.Data.SqlClient.SqlDataAdapter not Microsoft.Data.SqlClient

Open
#8,534 2 comments 0 reactions 2 assignees Claimed by @merriemcgaw View on GitHub
area-VSDesigner
Dominant language
C#
Stars
4.9k
Forks
1.1k
Avg merge
1d 13m
Merged PRs (30d)
85

Description

### Environment

VisualStudio.17.Release/17.4.4+33213.308
Microsoft .NET Framework
Version 4.8.04084

### .NET version

4.8

### Did this work in a previous version of Visual Studio and/or previous .NET release?

no

### Issue description

i am trying to move from "System.Data.SqlClient" to "Microsoft.Data.SqlClient",
and all my code is working,
but when i change the dataset autogenerated code to use the new "Microsoft.Data.SqlClient.SqlDataAdapter"
it works, but when adding any new tables or changing the fields in the dataset designer, it returns the "SqlDataAdapter" to use:
"System.Data.SqlClient.SqlDataAdapter"
so how to make the designer stay using the new "Microsoft.Data.SqlClient.SqlDataAdapter".
and this is also happening to:
private global::System.Data.SqlClient.SqlDataAdapter _adapter;
private global::System.Data.SqlClient.SqlConnection _connection;
private global::System.Data.SqlClient.SqlTransaction _transaction;
private global::System.Data.SqlClient.SqlCommand[] _commandCollection;

e.g.:
namespace MetaObjectDAL.DS_FormsTableAdapters {


///
///Represents the connection and commands used to retrieve and save data.
///
[global::System.ComponentModel.DesignerCategoryAttribute("code")]
[global::System.ComponentModel.ToolboxItem(true)]
[global::System.ComponentModel.DataObjectAttribute(true)]
[global::System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner" +
", Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public partial class MetaObjectTableAdapter : global::System.ComponentModel.Component {

private global::System.Data.SqlClient.SqlDataAdapter _adapter;

private global::System.Data.SqlClient.SqlConnection _connection;

private global::System.Data.SqlClient.SqlTransaction _transaction;

private global::System.Data.SqlClient.SqlCommand[] _commandCollection;

### Steps to reproduce

create a new winforms solution
add a dataset from sql server tables.
the compile it.
then add nuget "Microsoft.Data.SqlClient"
and replace all references of "Microsoft.Data.SqlClient" to "System.Data.SqlClient"
save and re-compile.

then open the dataset in designer mode, and add to it a new table from sql server.
save it.
go to the Dataset code, and u will see that it returned to the old: "System.Data.SqlClient"

### Diagnostics

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.