How to write the Stored Procedure Code in. net to the data connection Layer

Source: Internet
Author: User
Tags oracleconnection

Oracle
1. Create an Oracle Stored Procedure
Create or replace procedure proce_test (paramin in varchar2, paramout out varchar2, paraminout in out varchar2)
As
Varparam varchar2 (28 );
Begin
Varparam: = paramin;
Paramout: = varparam | paraminout;
End;
2. Test the Stored Procedure
Declare
Param_out varchar2 (28 );
Param_inout varchar2 (28 );
Begin
Param_inout: = 'ff ';
Proce_test ('dd', param_out, param_inout );
Dbms_output.put_line (param_out );
End;
Test result: ddff
C #
1. Create an Interface
Type
Object Name
Text property value
Button
Button1
Call
Label
Label1
A:
Label
Label2
B:
Label
Label3
Input
Label
Label4
Inputoutput
Label
Label5

TextBox
TextBox1

TextBox
TextBox2

2. display code
(1) In the WebForm4.aspx. cs File
Add the FIELD private OraOprater mOra = null; // OraOprater is the class of the Data Connection layer.
Double-click the "call" button on the interface and write the following code:
Private void button#click (object sender, System. EventArgs e)
{
MOra = new OraOprater ();
Label5.Text = mOra. SpExeFor (TextBox1.Text, TextBox2.Text); // call the Stored Procedure Method
}
(2) code in the data connection layer (OraOprater. cs)
Reference Oracle components
Using System;
Using System. Data;
Using System. Data. OracleClient;
Namespace WebApplication4
{
Public class OraOprater
{
Private OracleConnection conn = null;
Private OracleCommand cmd = null;

Public OraOprater ()
{
String mConn = "data source = ora9i.ora.com; user id = ora; password = ora"; // connect to the database
Conn = new OracleConnection (mConn );
Try
{
Conn. Open ();
Cmd = new OracleCommand ();

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.