惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

C
CXSECURITY Database RSS Feed - CXSecurity.com
K
Kaspersky official blog
A
Arctic Wolf
Attack and Defense Labs
Attack and Defense Labs
L
LINUX DO - 热门话题
N
News | PayPal Newsroom
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
L
Lohrmann on Cybersecurity
PCI Perspectives
PCI Perspectives
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
The Last Watchdog
The Last Watchdog
B
Blog RSS Feed
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
W
WeLiveSecurity
Know Your Adversary
Know Your Adversary
博客园 - Franky
T
Tenable Blog
T
Tailwind CSS Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Help Net Security
Help Net Security
WordPress大学
WordPress大学
T
The Exploit Database - CXSecurity.com
www.infosecurity-magazine.com
www.infosecurity-magazine.com
博客园 - 司徒正美
阮一峰的网络日志
阮一峰的网络日志
D
Darknet – Hacking Tools, Hacker News & Cyber Security
H
Heimdal Security Blog
TaoSecurity Blog
TaoSecurity Blog
S
Security Affairs
J
Java Code Geeks
小众软件
小众软件
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Apple Machine Learning Research
Apple Machine Learning Research
NISL@THU
NISL@THU
O
OpenAI News
The Cloudflare Blog
月光博客
月光博客
Google Online Security Blog
Google Online Security Blog
V
V2EX
罗磊的独立博客
美团技术团队
博客园 - 三生石上(FineUI控件)
Security Latest
Security Latest
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
C
Cyber Attacks, Cyber Crime and Cyber Security
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Cyberwarzone
Cyberwarzone
L
LINUX DO - 最新话题
Hacker News - Newest:
Hacker News - Newest: "LLM"
大猫的无限游戏
大猫的无限游戏

博客园 - 宽田

SQLite在.NET中自适应32位/64位系统 OWIN是什么? 好的用户界面-界面设计的一些技巧 Android模拟器连接本李服务器localhost win7 64位 VS2010调试提示“ORA-12154: TNS: 无法解析指定的连接标识符”的解决方法 Js 验证中文字符长度 Javascript技巧 解释器模式(interpreter): 访问者模式(Visitor) 职责链模式(Chain of Responsibility) Web Service 中返回DataSet结果大小改进 ORACLE WITH AS 用法 Oracle REGEXP_INSTR 用法 C# 实现自定义事件 错误:200, Stream not found, NetStream.Play.StreamNotFound, clip: '[Clip] GetCallbackEventReference(客户端调用服务器端)的用法 wcf Svcutil用法 IIS 增加net.tcp绑定 客户端字符集NLS_LANG
通用数据链接(UDL)的用法
宽田 · 2012-11-05 · via 博客园 - 宽田

偶然看到UDL,决定看一下其用法。

UDL:通用数据链接。此文件中提供 OleDbConnection 的连接信息。也就是说UDL只能在OleDbConnection中使用。

微软不建议使用UDL

    因为UDL 文件未加密,会以明文形式公开连接字符串信息。因为 UDL 文件对您的应用程序来说是一个基于文件的外部资源,所以无法使用 .NET Framework 保护该文件。

用法:   

    在桌面上建一个名为conn的txt文本文件,然后将后缀名改为udl 。双击它,打开相应连接界面,根据界面提示配置连接信息。这里选择的是Oralce。

    配置成功后UDL内容为:

[oledb]
; Everything after this line is an OLE DB initstring
Provider=OraOLEDB.Oracle.1;Password=gsc;Persist Security Info=True;User ID=gsc;Data Source=NDEV

代码中使用此UDL时,ConnectionString 需要为“File Name =”+UDL地址。

        

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);
            }
        }