Using the Data Link Properties Dialog Box
Số trang: 2
Loại file: pdf
Dung lượng: 12.37 KB
Lượt xem: 4
Lượt tải: 0
Xem trước 2 trang đầu tiên của tài liệu này:
Thông tin tài liệu:
[ Team LiB ] Recipe 1.13 Using the Data Link Properties Dialog Box Problem You want to display the Data Link Properties dialog box from an application so that users can create their own database connections just as they can from the Server Explorer window in the Visual Studio .NET IDE.
Nội dung trích xuất từ tài liệu:
Using the Data Link Properties Dialog Box [ Team LiB ]Recipe 1.13 Using the Data Link Properties Dialog BoxProblemYou want to display the Data Link Properties dialog box from an application so that userscan create their own database connections just as they can from the Server Explorerwindow in the Visual Studio .NET IDE.SolutionUse COM interop with the OLE DB Service Component to display the Data LinkProperties dialog box.Youll need a reference to the Primary Interop Assembly (PIA) for ADO provided in thefile ADODB.DLL; select adodb from the .NET tab in Visual Studio .NETs AddReference Dialog. Youll also need a reference to the Microsoft OLE DB ServiceComponent 1.0 Type Library from the COM tab in Visual Studio .NETs Add ReferenceDialog.The sample code contains a single event handler:Data Link Dialog Button.Click Creates and displays a Data Link Properties dialog box using the Microsoft OLE DB Service Component through COM interop.The C# code is shown in Example 1-10.Example 1-10. File: DataLinkDialogForm.cs// Namespaces, variables, and constantsusing System;// . . .private void dataLinkDialogButton_Click(object sender, System.EventArgs e){ ADODB.Connection conn = new ADODB.Connection( ); object oConn = (object) conn; MSDASC.DataLinks dlg = new MSDASC.DataLinks( ); dlg.PromptEdit(ref oConn); connectionStringTextBox.Text = conn.ConnectionString;}DiscussionCOM interop can open a Data Link Properties dialog box allowing a user to select anOLE DB provider and set its properties. You can use the results programmatically toconstruct the connection string for an ADO.NET connection object at runtime with a GUI(graphical user interface).[ Team LiB ]
Nội dung trích xuất từ tài liệu:
Using the Data Link Properties Dialog Box [ Team LiB ]Recipe 1.13 Using the Data Link Properties Dialog BoxProblemYou want to display the Data Link Properties dialog box from an application so that userscan create their own database connections just as they can from the Server Explorerwindow in the Visual Studio .NET IDE.SolutionUse COM interop with the OLE DB Service Component to display the Data LinkProperties dialog box.Youll need a reference to the Primary Interop Assembly (PIA) for ADO provided in thefile ADODB.DLL; select adodb from the .NET tab in Visual Studio .NETs AddReference Dialog. Youll also need a reference to the Microsoft OLE DB ServiceComponent 1.0 Type Library from the COM tab in Visual Studio .NETs Add ReferenceDialog.The sample code contains a single event handler:Data Link Dialog Button.Click Creates and displays a Data Link Properties dialog box using the Microsoft OLE DB Service Component through COM interop.The C# code is shown in Example 1-10.Example 1-10. File: DataLinkDialogForm.cs// Namespaces, variables, and constantsusing System;// . . .private void dataLinkDialogButton_Click(object sender, System.EventArgs e){ ADODB.Connection conn = new ADODB.Connection( ); object oConn = (object) conn; MSDASC.DataLinks dlg = new MSDASC.DataLinks( ); dlg.PromptEdit(ref oConn); connectionStringTextBox.Text = conn.ConnectionString;}DiscussionCOM interop can open a Data Link Properties dialog box allowing a user to select anOLE DB provider and set its properties. You can use the results programmatically toconstruct the connection string for an ADO.NET connection object at runtime with a GUI(graphical user interface).[ Team LiB ]
Tìm kiếm theo từ khóa liên quan:
công nghệ thông tin kỹ thuật lập trình Oreilly Ado Dot Net Cookbook Ebook-Lib Using the Data Link Properties Dialog BoxGợi ý tài liệu liên quan:
-
52 trang 430 1 0
-
Top 10 mẹo 'đơn giản nhưng hữu ích' trong nhiếp ảnh
11 trang 314 0 0 -
74 trang 299 0 0
-
96 trang 293 0 0
-
Báo cáo thực tập thực tế: Nghiên cứu và xây dựng website bằng Wordpress
24 trang 289 0 0 -
Đồ án tốt nghiệp: Xây dựng ứng dụng di động android quản lý khách hàng cắt tóc
81 trang 281 0 0 -
EBay - Internet và câu chuyện thần kỳ: Phần 1
143 trang 275 0 0 -
Tài liệu dạy học môn Tin học trong chương trình đào tạo trình độ cao đẳng
348 trang 269 1 0 -
Kỹ thuật lập trình trên Visual Basic 2005
148 trang 265 0 0 -
Tài liệu hướng dẫn sử dụng thư điện tử tài nguyên và môi trường
72 trang 265 0 0