Accidentally saw the UDL, decided to look at its usage.
UDL: Universal Data link. The connection information for OleDbConnection is provided in this file. This means that the UDL can only be used in OleDbConnection.
Microsoft does not recommend using UDL
Because the UDL file is not encrypted, the connection string information is exposed in clear text. Because the UDL file is a file-based external resource for your application, you cannot protect the file with the. NET Framework.
Usage:
Build a txt text file named Conn on the desktop and change the suffix name to UDL. Double-click on it, open the appropriate connection interface, according to the interface prompts to configure the connection information. The choice here is oralce.
After the configuration is successful, the UDL content is:
[OLE DB]; Everything after this is a OLE DB initstring Provider=oraoledb.oracle. 1; Password=GSC; Persist Security Info=true; User ID=gsc;data Source=ndev
When using this UDL in code, ConnectionString needs to be the "File Name =" +udl address.
private void GetData () { using (OleDbConnection oleconn = new OleDbConnection ()) { oleconn. ConnectionString = @ "File Name =" + Server.MapPath ("conn.udl"); OleDbCommand Olecommand = new OleDbCommand (); Olecommand. Connection = Oleconn; Olecommand.commandtext = "SELECT * from customization"; Oleconn. Open (); OleDbDataAdapter oleadapter = new OleDbDataAdapter (); Oleadapter. SelectCommand = Olecommand; DataSet ds = new DataSet (); Oleadapter. Fill (DS); } }
Usage of universal Data Link (UDL)