NOTICE  |  twitter.com/kichulkim |  Kevin is...

In .NET it is very easy to use the OleDB datalink connection dialog to build Connectionstrings at runtime.

To do this, you must first add references to both the
Microsoft ActiveX Data Objects 2.x Library (=ADODB namespace)
and the
Microsoft OLE DB Service Component 1.0 Type Library (=MSDASC namespace).


In C# the code looks something like this:

public string GetOLEConnectionString(string currConnString)
{
     string connString = string.Empty;

     MSDASC.DataLinks dataLinks = new MSDASC.DataLinksClass();
     ADODB.Connection ADOConn = new ADODB.ConnectionClass();

     ADOConn.ConnectionString = currConnString;
         
     object oConnection = (object)ADOConn;
         
     if (dataLinks.PromptEdit(ref oConnection))
     {
           connString = ADOConn.ConnectionString;
     }
     else
     {
           connString = currConnString;
     }
     return connString;
}


Referred to:
http://support.microsoft.com/kb/310083/en-us
 이전  123   다음 

전체 (58)
Kevin Kim (58)
Someone (0)
최근댓글
최근트랙백
fotowall :: ncloud tattertools RSS Feeds today : 179   yesterday : 538
total : 1158894