Using the Pipe to install RemSqlCe.dllBefore being able to remotely access a mobile database, you have to install the appropriate version of the RemSqlCe.dll file on the target device. The install process can be made either manually by copying the file through the ActiveSync browser, through a setup process using the provided cab file or it can be automatically installed on the target device when using RAPI (ActiveSync). To see how this can be done, we must understand how a RAPI connection is established with a cradled device and how the code takes advantage of it. When your application opens a SqlCeConnection object with the default ActiveSync connectivity, the library code actually calls Pipe.OpenRAPI or Pipe.TryOpenRAPI. The low-level sequence of events is as follows:
So, if you want to have your Pipe object automatically install the required device component, you just need to set the Pipe.EnableInstall and Pipe.DllPath properties with the correct values. Ok, but what if I am using a SqlCeConnection class, how do I set these properties? As a matter of fact, the SqlCeConnection class does expose a Pipe property. This internal object is always created in the SqlCeConnection's constructor and can be manipulated as a standalone one through that property. The properties we discussed are only relevant when the SqlCeConnection.Open method is called, so they can be set anytime after construction and before opening the connection.
|
