SqlBulkCopy.ClearCachedMetadata Method

Definition

Clears the cached destination table metadata when using the CacheMetadata option.

public:
 void ClearCachedMetadata();
public void ClearCachedMetadata();
member this.ClearCachedMetadata : unit -> unit
Public Sub ClearCachedMetadata ()

Remarks

Call this method when you know the destination table schema has changed and you want to force the next WriteToServer operation to refresh the metadata from the server.

The cache is automatically invalidated when the DestinationTableName property is changed to a different table name.

The cache is not automatically invalidated when the connection context changes. Call this method if the underlying SqlConnection changes database (for example, via ChangeDatabase(String)) or reconnects to a different server due to failover.

Applies to