The. net WinForm program calls the data connection configuration interface in Visual Studio IDE (a DLL)

Source: Internet
Author: User

After directly tuning the database configuration interface, you must be familiar with the following three items: Microsoft. data. connectionUI. dialog. dll-Microsoft's built-in data connection configuration interface library Microsoft. data. connectionUI. dll-Microsoft's built-in data connection configuration interface library Microsoft. data. connectionUI. dialog. resources. the problem with the Language Pack in the dll Microsoft Data Connection configuration interface library is that the original usage of these three things will generate a structure such as app---app.exe --- Microsoft. data. connectionUI. dialog. dll --- Microsoft. data. connectionUI. dll --- zh-CN --- Microsoft. data. connectionUI. dialog. resources. dll is used between native DLL and Language Pack. net Resource DLL (Microsoft. Data. ConnectionUI. Dialog. resources. dll) "Zh-CN" ing, all the physical storage of the application does not look too beautiful. Here, I want to integrate the three DLL into a DLL and use it directly in the program. The distribution of the published program is shown in. App---App.exe --- DBConnectSetting. dll A DBConnectSetting. dll contains the above three key DLL, which is the core of this integration. Solution 1: integrate Microsoft. Data. ConnectionUI. Dialog. dllMicrosoft. Data. ConnectionUI. dll. These two are the core code, and all the logic is in them. 2. DBConnectSetting after localization integration. dll makes it contain Chinese characters, and no longer plug-in resources Microsoft. data. connectionUI. dialog. resources. dll implementation process: 1. integrate the two DLL to use ILMergeGui. Note that you must first install ILMergeILMerge: http://research.microsoft.com/en-us/people/mbarnett/ilmerge.aspxILMergeGui : https://ilmergegui.codeplex.com/ After selecting two files, merge the output. Merge configurations as follows 2. Use DotNetHelper to decompile Microsoft. data. connectionUI. dialog. resources. dll, extract the contained resource files, and use the resource files with Zh-CN to replace the resource files without Zh-CN, copy a processed resource file and prepare the following operations. 3. decompile the merged file DBConnectSetting. dll and overwrite all the prepared resource files, and re-compile the file with DotNetHelper. The final generated DBConnectSetting. dll is a compiled file. Note: An error is reported during the re-Compilation of this integration. Re-compilation is not successful. Note that the translated resource file string is too long. If an error is reported for some resource files, Resourcer for is used. NET. 4. Finished! Program call display:
Click to change the data source to support multiple data source types, which are supported by Microsoft. Click Advanced to configure the connection string in detail, which is also supported by Microsoft native. The code in C # is as follows: [csharp] Microsoft. data. connectionUI. dataConnectionDialog dlg = new Microsoft. data. connectionUI. dataConnectionDialog (); // data source types supported by the Add interface dlg. dataSources. add (Microsoft. data. connectionUI. dataSource. sqlDataSource); dlg. dataSources. add (Microsoft. data. connectionUI. dataSource. accessDataSource); dlg. dataSources. add (Microsoft. data. connectionUI. dataSource. odbcDataSource); dlg. dataSources. add (Micros Oft. data. connectionUI. dataSource. oracleDataSource); dlg. dataSources. add (Microsoft. data. connectionUI. dataSource. sqlFileDataSource); dlg. selectedDataSource = Microsoft. data. connectionUI. dataSource. sqlDataSource; dlg. selectedDataProvider = Microsoft. data. connectionUI. dataProvider. sqlDataProvider; // assign an existing connection string to the interface control dlg. connectionString = this. connectString; Microsoft. data. connectionUI. dataConnectio NDialog. Show (dlg, owner); if (! String. IsNullOrEmpty (dlg. ConnectionString) {// Save the modified interface configuration and connect to the text this. ConnectString = dlg. ConnectionString ;}

Related Article

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.