简体   繁体   English

vb.net用户输入ole db连接字符串

[英]vb.net user entered ole db connection string

I'm new to vb.net and have run into a road block. 我是vb.net的新手,遇到了一个障碍。 I'm making an application that connects to a database with a user entered data connection string. 我正在制作一个使用用户输入的数据连接字符串连接到数据库的应用程序。 Trying not to reinvent the wheel, I looked for the vb.net equivalent of 'OLE DB Core Services', the properties menu when editing an .udl file and came up empty handed. 为了不费吹灰之力,我在搜索.udl文件时寻找了与“ OLE DB Core Services”等效的vb.net,即属性菜单,然后空手而归。 Is there a way to call this service to edit an embedded .udl or resource? 有没有一种方法可以调用此服务来编辑嵌入式.udl或资源? or vb.net forms/functions for getting connection string information from the user? 或从用户那里获取连接字符串信息的vb.net表单/功能?

As per this article : 根据本文

to properly configure the UDL properties programmatically would involve a call to the SDK for the Microsoft Host Integration Server. 要以编程方式正确配置UDL属性,将涉及对Microsoft Host Integration Server的SDK的调用。 You can use LabVIEW to call a .NET Assembly in order to accomplish this, but this is recommended only for experienced users that are familiar with .NET and ADO-compliant drivers. 您可以使用LabVIEW调用.NET程序集来完成此操作,但是建议只有熟悉.NET和ADO兼容驱动程序的有经验的用户才能使用。

May I suggest An alternative solution: 我可以建议一个替代解决方案:

Could you just let the user enter the connection string in an input form of some kind and then use OleDbConnectionStringBuilder to validate and then store the connection string? 您是否可以让用户以某种输入形式输入连接字符串,然后使用OleDbConnectionStringBuilder进行验证然后存储连接字符串? As per MSDN page : 根据MSDN页面

The connection string builders let developers programmatically create syntactically correct connection strings, and parse and rebuild existing connection strings. 连接字符串构建器允许开发人员以编程方式创建语法正确的连接字符串,并解析和重建现有的连接字符串。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM