tailieunhanh - ASP.NET 4 Unleased - p 42

Kết nối với cơ sở dữ liệu khác Nếu bạn cần kết nối với bất kỳ máy chủ cơ sở dữ liệu khác với Microsoft SQL Server, bạn cần phải sửa đổi sở hữu ProviderName sự kiểm soát của SqlDataSource. . Các NET Framework bao gồm các nhà cung cấp sau đây:. dụng các nhà cung cấp cho Oracle khi kết nối với một Oracle | 384 CHAPTER 9 Using the SqlDataSource Control body form id form1 runat server div asp TextBox id txtConnectionString Columns 60 Runat Server asp Button id btnConvert Text Convert OnClick btnConvert_Click Runat Server hr asp Label id lblResult Runat server div form body html After opening the page in Listing if you enter a connection string that looks like this Server localhost UID webuser pwd secret database Northwind the page converts the connection string to look like this Data Source localhost Initial Catalog Northwind User ID webuser Password secret Connecting to Other Databases If you need to connect to any database server other than Microsoft SQL Server you need to modify the SqlDataSource control s ProviderName property. The .NET Framework includes the following providers Use the provider for Oracle when connecting to an Oracle database. Use the OLE DB provider when connecting to a data source that supports an OLE DB provider. Use the ODBC provider when connecting to a data source with an ODBC driver. From the Library of Wow eBook Creating Database Connections 385 NOTE You can configure additional providers that you can use with the SqlDataSource control by adding new entries to the DbProviderFactories section of the file. For performance reasons you should always use the native provider for a database. However if your database does not have an provider you need to use either OLE DB or ODBC to connect to the database. Almost every database under the sun has either an OLE DB provider or an ODBC driver. For example the page in Listing uses the Oracle provider to connect to an Oracle database. LISTING @ Page Language C DOCTYPE html PUBLIC - W3C DTD XHTML EN http TR xhtml11 DTD html xmlns http 1999 xhtml head id Head1 runat server title Connect Oracle title head body form id form1 runat .

TÀI LIỆU LIÊN QUAN
crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.