Building ASP.NET Web Applications with Oracle Developer Tools for Visual Studio

<Do not delete this text because it is a placeholder for the generated list of "main" topics when run in a browser>

Purpose

This tutorial describes how you can build ASP.NET web applications that access Oracle Database using Oracle Developer Tools for Visual Studio.

Time to Complete

Approximately 20 minutes

Overview

Oracle Developer Tools for Visual Studio is a tightly integrated "add-in" for Visual Studio. This tight integration makes it easy to create ASP.NET Web Applications that access Oracle database without requiring the developer write much code.

 

Prerequisites

Before starting this tutorial, you should:

.

Install Microsoft Visual Studio 2010

.

Install Oracle Database 9.2 or later or Oracle Database XE

.

Install Oracle 11g Oracle Data Access Components (ODAC) with Oracle Developer Tools for Visual Studio version 11.2.0.1.2 or later from OTN

Creating a Web Site

To create an ASP.NET web site, perform the following steps:

.

From your Windows Start menu, start Visual Studio.

 

.

From File menu, select New > Web Site.

 

.

In the New Web Site window, select Visual C# : ASP.NET Web Site and click OK.

 

.

The project opens.

 

Creating the GridView

To create a gridview, perform the following steps:

.

In the Default.aspx tabbed page, click the Design tab. Highlight the text in the "Maincontent" subsection in the lower half of the design form

Highlight the text in the "Maincontent" subsection in the lower half of the design form

Delete all the text by clicking the delete key.

 

.

From View menu, select Toolbox.

 

.

Scroll down. In the toolbox, expand Data. Drag the GridView control to the Design area.

The design area gets the Gridview control as shown in the screenshot below.


Creating a Data Source

To create a new data source, perform the following steps:

.

If you do not see the GridView Tasks pane, click the >symbol to get it, as highlighted in the screenshot.

Select <New data source...> from the Choose Data Source drop down.

A Data Source Configuration wizard starts.

 

.

Select Database. Enter HR as the ID for the data source. Click OK.

 

.

Click New Connection...

 

.

In the Add Connection window, click the Change button

In the Change Data Source dialog box, select Oracle Database Server as the Data Source and Oracle Data Provider for .NET as the Data Provider.

 

.

Click OK.

 

.

Enter ORCL for Data source name, HR for the Username and Password and click the Save Password check box. Click Test Connection.

 

.

Your test was successful. Click OK.

 

.

Click OK.

 

.

Click Next.

.

Click Next to save the connect string in the application configuration file.

 

.

Select the EMPLOYEES table from the Name drop down. Click the checkbox in front of *. Click Next.

 

.

Click Test Query.

 

.

The result of your query is shown. Click Finish.

 

.

Click the Enable Paging checkbox.

Executing your Web Site

To run the ASP.NET web application, perform the following steps:

.

Select Build > Build Web Site.

 

.

Your website was built. Note: You may receive a script warning message that can be safely ignored.

 

.

Select Debug > Start Debugging.

 

.

Click OK to modify the web.config file to enable debugging.

 

.

A web browser will open showing the web application.

 

 

Summary

In this tutorial, you have learned how to:

 

Hardware and Software Engineered to Work Together About Oracle |Oracle and Sun | Oracle RSS Feeds | Careers | Contact Us | Site Maps | Legal Notices | Terms of Use | Your Privacy Rights