How to write the call stored procedure code to the data connection layer in. Net

Source: Internet
Author: User
Tags oracleconnection
Oracle Side
1. Creating Oracle Process Storage
Create or Replace procedure Proce_test (paramin in Varchar2,paramout out varchar2,paraminout into out varchar2)
As
Varparam VARCHAR2 (28);
Begin
Varparam:=paramin;
paramout:=varparam| | Paraminout;
End
2. Test process Storage
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 results: DDFF
C # Aspect
1. Creating 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 field private Oraoprater mora=null; Oraoprater is the class of the data connection layer
Double-click the Call button on the interface to write the following code:
private void Button1_Click (object sender, System.EventArgs e)
{
Mora=new Oraoprater ();
Label5.text=mora.spexefor (Textbox1.text,textbox2.text); Methods to invoke stored procedures
}
(2) code in the Data Connection layer (OraOprater.cs)
Referencing 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"; Connecting to a database
Conn=new OracleConnection (Mconn);
Try
{
Conn. Open ();
Cmd=new OracleCommand ();

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.