Keyword not supported: 'provider' with SqlBulkCopy

asp.net c# ms-access sqlbulkcopy vb.net

Question

I try to write access connection string in SqlBulkCopy but I got error Keyword not supported: 'provider'

here is my code:

bulk = New SqlBulkCopy("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & mFileName & ";Jet OLEDB:Database Password=hmis;")
bulk.DestinationTableName = "Advance"
bulk.WriteToServer(dt_table)

Accepted Answer

SqlBulkCopy only works with SQL Server. The constructor you are trying to call, SqlBulkCopy(string) expects a valid connection string for SQL Server. The connection string you passed works only with Access.

Different databases products have different mechanisms for bulk import operations. You can't use a class created for one database product to import data to another.

Microsoft Access has no bulk import support.


Popular Answer

The SQLBulkCopy Class is only supported with SQL Server connection string. You can't use other types of Connection Strings..




Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why