The ValidateDataSource method attempts a connection to the indicated data source using the login name and password specified.
object.ValidateDataSource( DataSource , Login , Password
[, SubscriberType ] )
Part | Description |
---|---|
object | Expression that evaluates to an object in the Applies To list. |
DataSource | Identifies an ODBC data source by name. |
Login | Specifies a Microsoft® SQL Server™ login by name. |
Password | Password for the specified SQL Server login. |
SubscriberType | Optional. A long integer identifying the Subscriber data source implementation as described in Settings. |
Constant | Value | Description |
---|---|---|
SQLDMOSubInfo_JetDatabase | 2 | DataSource argument identifies a Microsoft Jet version 3.5 database.. |
SQLDMOSubInfo_ODBCDatasource | 1 | Default. DataSource identifies an ODBC system or user DSN. |
SQLDMOSubInfo_OLEDBDatasource | 3 | DataSource identifies an OLE DB data source specification persisted as a SQL Server linked server. |
SQLDMOSubInfo_SQLServer | 0 | DataSource identifies a SQL Server installation by SQL Server name. |
If the ValidateDataSource method succeeds, the data source specified can be targeted in a subscription. The error SQLDMO_E_INVALIDDSN is raised when a connection is not made to the data source or the data source specified cannot otherwise receive a subscription.
HRESULT ValidateODBCDataSource(
SQLDMO_LPCSTR DataSourceName,
SQLDMO_LPCSTR Login,
SQLDMO_LPCSTR Password,
SQLDMO_SUBSCRIBER_TYPE SubscriberType = SQLDMOSubInfo_ODBCDatasource));