Upravit

Sdílet prostřednictvím


OLEDBConnection.Refresh Method

Definition

Refreshes an OLE DB connection.

public:
 void Refresh();
public void Refresh ();
Public Sub Refresh ()

Remarks

When making the connection to the OLE DB data source, Microsoft Excel uses the connection string specified by the Connection property. If the specified connection string is missing required values, dialog boxes will be displayed to prompt the user for the required information. If the DisplayAlerts property is False, dialog boxes are not displayed and the Refresh() method fails with the Insufficient Connection Information exception.

After Microsoft Excel makes a successful connection, it stores the completed connection string so that prompts will not be displayed for subsequent calls to the Refresh() method during the same editing session. You can obtain the completed connection string by examining the value of the Connection property.

After the database connection is made, the SQL query is validated. If the query is not valid, the Refresh() method fails with the SQL Syntax Error exception.

The Refresh() method returns True if the query is successfully completed or started; it returns False if the user cancels a connection.

To see whether the number of fetched rows exceeded the number of available rows on the worksheet, examine the FetchedRowOverflow property. This property is initialized every time the Refresh() method is called.

Applies to