0

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)
Soner Gönül
  • 97,193
  • 102
  • 206
  • 364

2 Answers2

2

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.

Panagiotis Kanavos
  • 120,703
  • 13
  • 188
  • 236
0

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

sergiogarciadev
  • 2,061
  • 1
  • 21
  • 35