I have an issue with SqlBulkCopy
command when using SQL Server authentication. The issue does not arise with Windows authentication.
SqlBulkCopy sbc = new SqlBulkCopy(sqConn.ConnectionString, SqlBulkCopyOptions.KeepIdentity);
this throws an error:
Login failed for user 'xx'
Code:
SqlBulkCopy sbc = new SqlBulkCopy(sqConn);
This works fine but does not preserve identity column original values.
"persist security info=true"
is required in the connection string. Otherwise password is stripped from sqlConn.ConnectionString
if the connection is already open.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With