FoxDataObjects

Object-Relational Mapping Tool for Visual FoxPro®

 SetDefaultDataSource  Method

 

 

Sets the default datasource object by creating an empty datasource object for a given data store brand name and storing the object reference in the Server.DefaultDataSource property. Returns .T. (True) if successful.

 Server.SetDefaultDataSource( cServerBrandName )

 

Return Values

 

Logical

   

Parameters

 

cServerBrandName

 

Specifies the data store brand name for the datasource object.

Remarks

 

The SetDefaultDataSource method receives a string parameter with the brand name of the server in order to instantiate a datasource object from the correct fdoDatasource subclass by calling Server.NewDataSource method. A case insensitive search is done over the brand name to detect this values:

SubString

fdoDataSource subclass

"fox" fdoDataSource_VisualFoxPro
"sqlserver" fdoDataSource_MsSQLServer
"oracle" fdoDataSource_Oracle
"mysql" fdoDataSource_MySQL
"postgre" fdoDataSource_PostgreSQL
"sybase" fdoDataSource_SybaseASE
"db2"  fdoDataSource_IBMDB2
"fire"  fdoDataSource_FireBird

If none of the substrings values exposed in the previous table can be located on the brand name string, the method returns .F. (False).

If a valid data store brand name is passed, this method gets an empty datasource object for the fdoDataSource subclass corresponding to the requested data store and stores the object reference in the Session.DefaultDataSource property.

The Server.DefaultDataSource property can be used by the Session.Connect method if no datasource object is specified.

 

Example

oServer.SetDefaultDatasource("Ms SqlServer")

oServer.DefaultDatasource.Database_Name="MyDatabase"
oServer.DefaultDatasource.ODBC_SRV="192.168.0.1"
oServer.DefaultDatasource.ODBC_UID="sa"
oServer.DefaultDatasource.ODBC_PWD=cPassword
 

See Also

DataSource class | Server.NewDataSource method | Server.DefaultDataSource property | Session.Connect method | Server.DefaultDataSourceLookupMode property

Applies to: Server object

Send feedback on this topic to RunAhead Technologies

For Technical support and product issues please contact us at support@foxdataobjects.com or visit http://www.foxdataobjects.com

Copyright (c) 2000-2005 RunAhead Technologies