I have created a sample app by using both the oledb provider(SQLOLEDB and SQL Native OLEDB provider).
Case 1 : Provider = SQLOLEDB
hr = ::CoInitializeEx(
Replace the connection string with
CString SSlcon_string = "provider=SQLOLEDB;Use Encryption for Data=True;server=MYPC;Database=MyDB";
The remaining steps will be same.Install the same certificate(present on server) on client machine's "truted root certificate authorities" folder.
If server and client both will have same certificate then connection will be established(SSL Connection) otherwise fail.