Creating a Recordset
Using a Named Database
Named databases can be created in the PSQL Control Center.
From the Control Center, right-click on the Configuration node and select Maintain Named Databases. This is the preferred method of specifying a data store, as the data can be moved, if necessary, without breaking your application. All you have to do to point your application to the new directory is to modify the named database paths at the server, limiting your change to one minor task, rather than having to reconfigure several client machines.
rs.Open "Course", "Provider=PervasiveOLEDB;Data Source=Demodata", adOpenDynamic, adLockBatchOptimistic, adCmdTableDirect
Using a Path
It is not recommended to hard-code paths into your application. However, if your application can retrieve a path from a registry entry or an environment variable and build the string below, using a path is an easy way to access a data store without having to define a named database.
rs.Open "Course", "Provider=PervasiveOLEDB;Data Source=d:\mydata\mydatabase", adOpenDynamic, adLockBatchOptimistic, adCmdTableDirect
Using the Location Parameter
As an alternative to a hard-coded path into your application, you can use the Location parameter in the connection string to connect to a remote database.
rs.Open "Course", "Provider=PervasiveOLEDB;Data Source=DEMODATA;Location=MyRemoteServer", adOpenDynamic, adLockBatchOptimistic, adCmdTableDirect
Using an Existing Connection
You can create a connection and then use that connection to create multiple recordsets. This is more efficient than creating a separate connection for each recordset.
rs.Open "Course", MyExistingConnection, adOpenDynamic, adLockBatchOptimistic, adCmdTableDirect