Usage of universal Data Link (UDL)

Source: Internet
Author: User
Tags ole

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.