通用数据链接文件 (*.UDL) 的创建

.Net 专栏收录该内容
44 篇文章 0 订阅

'引用 Microsoft OLE DB Service Component 1.0 Type Library
Option Explicit
Private Sub Command1_Click()
 Dim x As New MSDASC.DataLinks
 x.hWnd = Me.hWnd
 Dim s As String
 On Error GoTo ErrorHandler
 s = x.PromptNew
 On Error GoTo 0
 If VBA.Len(VBA.Trim(s & "")) > 0 Then
  Dim CommonDialog1 As New MSComDlg.CommonDialog
  CommonDialog1.DefaultExt = ".udl"
  CommonDialog1.Filter = "通用数据链接文件 (*.UDL)|*.udl"
  CommonDialog1.DialogTitle = "保存为通用数据链接文件"
  CommonDialog1.Flags = cdlOFNOverwritePrompt
  CommonDialog1.CancelError = True
  On Error GoTo ErrorHandler
  CommonDialog1.ShowSave
  On Error GoTo 0
  s = "[oledb]" & vbCrLf _
   & "; Everything after this line is an OLE DB initstring" & vbCrLf _
   & s & vbCrLf
  Dim BytesBuffer() As Byte
  BytesBuffer = VBA.StrConv(VBA.StrConv(s, vbUnicode), vbFromUnicode)
  Dim i As Long
  ReDim BytesBuffer0(1) As Byte
  BytesBuffer0(0) = 255 '&HFF
  BytesBuffer0(1) = 254 '&HFE
  If VBA.Len(VBA.Trim(VBA.Dir(CommonDialog1.FileName))) > 0 Then
   VBA.Kill CommonDialog1.FileName
  End If
  On Error GoTo ErrorHandler
  i = VBA.FreeFile
  Open CommonDialog1.FileName For Binary Access Write As #i
  Put #i, , BytesBuffer0
  Put #i, , BytesBuffer
  Close #i
  On Error GoTo 0
  If VBA.MsgBox("Test?", vbYesNo) = vbYes Then
   Dim adoConnection As New ADODB.Connection
   adoConnection.Open "File Name=" & CommonDialog1.FileName
   VBA.MsgBox "OK!"
  End If
 End If
 Exit Sub
ErrorHandler:
 If Err.Number <> 91 And Err.Number <> 32755 Then
  VBA.MsgBox Err.Number & ":" & vbCrLf & Err.Description
 End If
End Sub

Private Sub Command2_Click()
 Dim CommonDialog1 As New MSComDlg.CommonDialog
 CommonDialog1.DefaultExt = ".udl"
 CommonDialog1.Filter = "通用数据链接文件 (*.UDL)|*.udl"
 CommonDialog1.DialogTitle = "打开通用数据链接文件"
 'CommonDialog1.Flags = cdlOFNOverwritePrompt
 CommonDialog1.CancelError = True
 On Error GoTo ErrorHandler
 CommonDialog1.ShowOpen
 On Error GoTo 0
 If VBA.Len(VBA.Trim(VBA.Dir(CommonDialog1.FileName))) > 0 Then
  VBA.MsgBox GetConnectionStringFromUDL(CommonDialog1.FileName)
 End If
 Exit Sub
ErrorHandler:
 If Err.Number <> 91 And Err.Number <> 32755 Then
  VBA.MsgBox Err.Number & ":" & vbCrLf & Err.Description
 End If
End Sub

Public Function GetConnectionStringFromUDL(UDLFileName As String) As String
 If VBA.Len(VBA.Trim(VBA.Dir(UDLFileName & ""))) > 0 Then
  Dim BytesBuffer() As Byte
  ReDim BytesBuffer(VBA.FileLen(UDLFileName) - 133) As Byte
  Dim i As Long
  i = VBA.FreeFile
  Open UDLFileName For Binary Access Read As #i
  Get #i, 129, BytesBuffer
  Close #i
  GetConnectionStringFromUDL = VBA.Trim(VBA.StrConv(VBA.StrConv(BytesBuffer, vbFromUnicode), vbUnicode))
 End If
End Function

  • 0
    点赞
  • 0
    评论
  • 0
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

<p style="font-family: tahoma, 微软雅黑, arial, 宋体; margin: 0px; padding: 0px; box-sizing: border-box; border: 0px; outline: 0px; font-size: 14px; vertical-align: baseline; background: #ffffff; list-style-type: none; color: #333333; word-spacing: 1px;">ClickHouse是一个用于OLAP数据分析引擎,由俄罗斯搜索巨头Yandex公司开源。</p> <p style="font-family: tahoma, 微软雅黑, arial, 宋体; margin: 0px; padding: 0px; box-sizing: border-box; border: 0px; outline: 0px; font-size: 14px; vertical-align: baseline; background: #ffffff; list-style-type: none; color: #333333; word-spacing: 1px;">1、可支持PB级超大容量数据库管理系统。</p> <p style="font-family: tahoma, 微软雅黑, arial, 宋体; margin: 0px; padding: 0px; box-sizing: border-box; border: 0px; outline: 0px; font-size: 14px; vertical-align: baseline; background: #ffffff; list-style-type: none; color: #333333; word-spacing: 1px;">2、基于SQL语句, 使用成本低。 </p> <p style="font-family: tahoma, 微软雅黑, arial, 宋体; margin: 0px; padding: 0px; box-sizing: border-box; border: 0px; outline: 0px; font-size: 14px; vertical-align: baseline; background: #ffffff; list-style-type: none; color: #333333; word-spacing: 1px;">3、超亿级数据量分析秒级响应,计算性能横向扩展。</p> <p style="font-family: tahoma, 微软雅黑, arial, 宋体; margin: 0px; padding: 0px; box-sizing: border-box; border: 0px; outline: 0px; font-size: 14px; vertical-align: baseline; background: #ffffff; list-style-type: none; color: #333333; word-spacing: 1px;">4、海量数据即查即用。</p> <p style="font-family: tahoma, 微软雅黑, arial, 宋体; margin: 0px; padding: 0px; box-sizing: border-box; border: 0px; outline: 0px; font-size: 14px; vertical-align: baseline; background: #ffffff; list-style-type: none; color: #333333; word-spacing: 1px;">5、提供数据预聚合能力,进一步提升数据查询效率。</p> <p style="font-family: tahoma, 微软雅黑, arial, 宋体; margin: 0px; padding: 0px; box-sizing: border-box; border: 0px; outline: 0px; font-size: 14px; vertical-align: baseline; background: #ffffff; list-style-type: none; color: #333333; word-spacing: 1px;">6、列式存储, 数据压缩,降低磁盘IO和网络IO,提升计算性能,节约70%物理存储。</p> <p style="font-family: tahoma, 微软雅黑, arial, 宋体; margin: 0px; padding: 0px; box-sizing: border-box; border: 0px; outline: 0px; font-size: 14px; vertical-align: baseline; background: #ffffff; list-style-type: none; color: #333333; word-spacing: 1px;">7、支持副本, 实现跨机房数据容灾。</p> <p style="font-family: tahoma, 微软雅黑, arial, 宋体; margin: 0px; padding: 0px; box-sizing: border-box; border: 0px; outline: 0px; font-size: 14px; vertical-align: baseline; background: #ffffff; list-style-type: none; color: #333333; word-spacing: 1px;"><br style="font-family: 'Helvetica Neue', Helvetica, 'Hiragino Sans GB', Arial, sans-serif; margin: 0px; padding: 0px;" />课程基于ClickHouse**20.x版本,从理论到实践,由浅入深详解ClickHouse原理和使用。</p> <p style="font-family: tahoma, 微软雅黑, arial, 宋体; margin: 0px; padding: 0px; box-sizing: border-box; border: 0px; outline: 0px; font-size: 14px; vertical-align: baseline; background: #ffffff; list-style-type: none; color: #333333; word-spacing: 1px;">1. 本课程从零开始,有Linux操作系统和SQL使用经验即可。</p> <p style="font-family: tahoma, 微软雅黑, arial, 宋体; margin: 0px; padding: 0px; box-sizing: border-box; border: 0px; outline: 0px; font-size: 14px; vertical-align: baseline; background: #ffffff; list-style-type: none; color: #333333; word-spacing: 1px;">2. 课程以案例驱动,包含大量实践案例。</p> <p style="font-family: tahoma, 微软雅黑, arial, 宋体; margin: 0px; padding: 0px; box-sizing: border-box; border: 0px; outline: 0px; font-size: 14px; vertical-align: baseline; background: #ffffff; list-style-type: none; color: #333333; word-spacing: 1px;">3. 将ClickHouse与MySQL、Kafka、HDFS等第三方系统集成,增强ClickHouse功能。</p> <p style="font-family: tahoma, 微软雅黑, arial, 宋体; margin: 0px; padding: 0px; box-sizing: border-box; border: 0px; outline: 0px; font-size: 14px; vertical-align: baseline; background: #ffffff; list-style-type: none; color: #333333; word-spacing: 1px;">4. 课程覆盖面广,既有基础功能详细讲解, 也包含了集群部署、查询优化、运维管理等高级内容。</p>
相关推荐
<p class="MsoNormal" style="text-align:left;background:white;" align="left"> <span style="font-size:13.5pt;font-family:'微软雅黑',sans-serif;color:#3598db;">【为什么要学习这门课】</span> </p> <p class="MsoNormal" style="text-align:left;background:white;" align="left"> <span style="font-family:'微软雅黑',sans-serif;color:#222226;">Linux</span><span style="font-family:'微软雅黑',sans-serif;color:#222226;">创始人<span>Linus Torvalds</span>有一句名言:<span>Talk is cheap. Show me the code. </span></span><span style="font-family:微软雅黑, sans-serif;color:#e03e2d;background-color:#ffffff;">冗谈不够,放码过来!</span><span style="font-family:'微软雅黑',sans-serif;color:#222226;">代码阅读是从基础到提高必由之路。 </span> </p> <p class="MsoNormal" style="text-align:left;background:white;" align="left"> <span style="font-family:'微软雅黑',sans-serif;color:#222226;">YOLOv5</span><span style="font-family:'微软雅黑',sans-serif;color:#222226;">是最近推出轻量且高性能实时目标检测方法。<span>YOLOv5</span>使用<span>PyTorch</span>实现,含有很多业界前沿和常用技巧,可以作为很好代码阅读案例,让我们深入探究其实现原理,其中不少知识点代码可以作为相关项目借鉴。</span> </p> <p class="MsoNormal" style="text-align:left;background:white;" align="left"> <span style="font-size:13.5pt;font-family:'微软雅黑',sans-serif;color:#3598db;">【课程内容与收获】</span> </p> <p class="MsoNormal" style="text-align:left;background:white;" align="left"> <span style="font-family:'微软雅黑',sans-serif;color:#222226;">本课程将详细解析<span>YOLOv5</span>实现原理和源码,对关键代码使用<span>PyCharm</span><span>debug</span>模式逐行分析解读。 本课程将提供注释后<span>YOLOv5</span>源码程序文件。</span> </p> <p class="MsoNormal" style="text-align:left;background:white;" align="left"> <span style="font-family:'微软雅黑',sans-serif;color:#222226;"> <img src="https://img-bss.csdnimg.cn/202012061533559839.jpg" alt="课程内容" /></span> </p> <p class="MsoNormal" style="text-align:left;background:white;" align="left"> <span style="font-size:13.5pt;font-family:'微软雅黑',sans-serif;color:#3598db;">【相关课程】</span> </p> <p style="margin-left:0cm;"> 本人推出了有关YOLOv5目标检测系列课程。请持续关注该系列其它视频课程,包括: </p> <p> 《YOLOv5(PyTorch)目标检测实战:训练自己数据集》 </p> <p> Ubuntu系统 <strong><a href="https://edu.csdn.net/course/detail/30793"><span style="color:#7c79e5;">https://edu.csdn.net/course/detail/30793</span></a></strong> </p> <p> Windows系统 <strong><a href="https://edu.csdn.net/course/detail/30923"><span style="color:#7c79e5;">https://edu.csdn.net/course/detail/30923</span></a></strong> </p> <p> 《YOLOv5(PyTorch)目标检测:原理与源码解析》<strong><a href="https://edu.csdn.net/course/detail/31428"><span style="color:#7c79e5;">https://edu.csdn.net/course/detail/31428</span></a></strong> </p> <p> 《YOLOv5(PyTorch)目标检测实战:Flask Web部署》<strong><a href="https://edu.csdn.net/course/detail/31087"><span style="color:#7c79e5;">https://edu.csdn.net/course/detail/31087</span></a></strong> </p> <p> 《YOLOv5(PyTorch)目标检测实战:TensorRT加速部署》<strong><a href="https://edu.csdn.net/course/detail/32303"><span style="color:#7c79e5;">https://edu.csdn.net/course/detail/32303</span></a></strong> </p>
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值