Controls You Can Use on Web Forms ASP.NET Data Source Controls SqlDataSource Control
You can use the SqlDataSource control to connect to an Oracle database by storing connection string information in the Web application’s Web.config file and then referencing the connection string from your SqlDataSource control.
NOTE: N:System.Data.OracleClient managed provider requires Oracle client software version 8.1.7 or higher to be installed on the computer where the ASP.NET Web page runs.
- Open the Web.config file in the root directory of your ASP.NET application. If you do not have a Web.config file, create one.
- In the Configuration element, add a ConnectionStrings element if one does not already exist.
- Create an add element as a child of the ConnectionStrings element, defining the following attributes:
- name   Set the value to the name that you want to use to reference the connection string.
- connectionString   Assign the connection string that is required to connect to the Oracle database. For information about the connection string values you must use, contact your database administrator.
- providerName   Assign the value "System.Data.OracleClient", which specifies that ASP.NET should use the ADO.NET System.Data.OracleClient provider when making a connection with this connection string.
Your completed add element might look like the following:
<add name="OracleConnectionString"
connectionString="Data Source=OracleServer1;Persist Security Info=True;Password="******";User ID=User1"
providerName="System.Data.OracleClient" />
NOTE: If you include explicit authentication information in a connection string, you should encrypt the ConnectionStrings section of the Web.config file. For details, see Encrypting Configuration Information Using Protected Configuration.