Pages

Friday, June 5, 2009

FILL DATA USING ORACLE STORE PROCEDURE IN ASP.NET C#

PROCEDURE "GET_ALL_AREA"

(

ITEMS_CURSOR OUT SYS_REFCURSOR

)

is


BEGIN

OPEN ITEMS_CURSOR FOR SELECT AREAID,AREANAME,AREAPINCODE FROM AREA;


END;


DataSet ds = new DataSet();

OracleCommand command = new OracleCommand();

command.CommandType = CommandType.StoredProcedure;

command.CommandText = “Get_All_Area”;

command.Connection = conn.Get_Connection();

command.Parameters.Add("ITEMS_CURSOR", OracleType.Cursor ).Direction = ParameterDirection.Output;

OracleDataAdapter adpt = new OracleDataAdapter(Command);

adpt.Fill(ds, str_table);

Close_Connection();

public string Connection_String

{

get

{

return ConfigurationSettings.AppSettings["dbConnectionString"];

}

}

//Function For Open New Connection

public OracleConnection Get_Connection()

{

try

{

OracleConn = new OracleConnection(Connection_String);

OracleConn.Open();

}

catch (Exception ex)

{

throw ex;

}

return OracleConn;

}

//Close Connection

public void Close_Connection()

{

try

{

OracleConn.Close();

}

catch(Exception ex)

{

throw new Exception(ex.Message, ex);

}

}

No comments:

ShareThis

Welcome

Welcome to Rajesh Prajapati, asp.net blog.
Here you can find some useful code and information about asp.net., c#, VB.net, SQL Server, Web Service, Web Designing etc