Search code examples
c#sqlconnection

How to create an SqlConnection in C# to point to UDL file


I have a .udl (Universal data link) file in my project. Now I want to create an SQL Connection that should point to this particular file. SqlConnection object expects a connection string, how can we build an SqlConnection using .UDL file?


Solution

  • From MSDN site:

    It is possible to supply connection information for an OleDbConnection in a Universal Data Link (UDL) file; however you should avoid doing so. UDL files are not encrypted, and expose connection string information in clear text. Because a UDL file is an external file-based resource to your application, it cannot be secured using the .NET Framework. UDL files are not supported for SqlClient.

    Have a look here:

    http://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/0bb40f32-86f4-4b6f-a2e0-bc2bdcf07b63