Ever wondered how to configure a connection string using the Data Link properties dialog?
Well, I have. And just last night I decided to check out exactly how to do this. Here's a simple list with all the required steps:
- Add a reference to "Microsoft OLE DB Service Component 1.0 Type Library" (it’s in the COM Tab)
- Add a reference to the Primary Interop Assembly (PIA) for ADO (Add References > adodb)
- Add the following code (for instance to a button click event handler):
We can also pre-assign the ConnectionString property of the Connection object before we open up the Data Link dialog.
If we do this, the dialog is already filled with the configuration from the connection string.