Skip to content
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

RowsCopied not available in 2.0 preview 2 #505

Closed
ErikEJ opened this issue Apr 5, 2020 · 2 comments · Fixed by #508
Closed

RowsCopied not available in 2.0 preview 2 #505

ErikEJ opened this issue Apr 5, 2020 · 2 comments · Fixed by #508

Comments

@ErikEJ
Copy link
Contributor

ErikEJ commented Apr 5, 2020

Describe the bug

I cannot use RowsCopied event, does not exist in SqlBulCopy class in 2.0 preview 2, event though readme states it should be available.

To reproduce

The code below does not compile. I expected it to.

            using (var sqlConnection = new SqlConnection("Data Source=(localdb)\\mssqllocaldb;Initial Catalog=Northwind;Integrated Security= true"))
            {
                sqlConnection.Open();
                using (var bulkCopy = new SqlBulkCopy(sqlConnection))
                {
                    bulkCopy.DestinationTableName = "Shippers";
                    bulkCopy.WriteToServer(new DataTable());
                    var rows = bulkCopy.RowsCopied;
                }
            }

Further technical details

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.Data.SqlClient" Version="2.0.0-preview2.20084.1" />
  </ItemGroup>
</Project>

@cheenamalhotra
Copy link
Member

Thanks @ErikEJ

Looks like we missed adding refs in the original PR. I've created PR #508 to fix the issue.

@ErikEJ
Copy link
Contributor Author

ErikEJ commented Apr 6, 2020

Thanks, I was planning a small blog post, but the property was missing! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants