This project has moved. For the latest updates, please go here.

Open AdoDataConnection from Custom Adapter

May 6, 2013 at 1:09 PM
Can I use the AdoDataConnection from a custom Adapter?

I am particularly interested in the constructor that will point to the connection string and data provider string in the openPDC.exe.config (or one of the other config) files.
public AdoDataConnection(string settingsCategory)
I am concerned how it will know which config file to pull from but I am assuming that it should be the same file that the openPDC Service pulls from since the adapter is running on the service. So this should give me an easy connection to my database for querying a custom table... right?

May 6, 2013 at 5:58 PM
Certainly. The config that will be used will always be associated with host executable (in your case the openPDC, so the config file will be openPDC.exe.config). The settings category tells the ADO data connection where to load its connection parameters for the database. To use the same connection settings used by the openPDC, specify "systemSettings" - otherwise to connect to another database add your own database configuration settings to the config (specifically the connectionString and dataproviderString").

Hope that helps!