Pass Data Set,Table - Oracle Stored Procedures
PROCEDURE AUTHENTICATE_TENANT_PROFILE
( USERNAME IN VARCHAR2,
TENANTPASSWORD IN VARCHAR2,
cRecSet OUT SYS_REFCURSOR
)
AS
sqlQuery varchar2(3000);
BEGIN
sqlQuery:= 'SELECT TenantID from TenantProfile
where
Username='|| USERNAME ||' AND TenantPassword='|| TENANTPASSWORD;
OPEN cRecSet FOR sqlQuery;
END;
-- below shows code behind the C# app.
public static DataTable getAllPRovinces()
{
DataTable dt = new DataTable();
dt = null;
try
{
Database db = DatabaseFactory.CreateDatabase("oracle_db");
OracleCommand oracle_command = new OracleCommand("AUTHENTICATE_TENANT_PROFILE");
oracle_command.Parameters.Add("USERNAME",OracleType.VarChar).Value=Textbox1.Text;
oracle_command.Parameters.Add("TENANTPASSWORD",OracleType.VarChar).Value=Textbox2.Text;
oracle_command.CommandType = CommandType.StoredProcedure;
OracleParameter outPara = oracle_command.Parameters.Add("cRecSet",OracleType.Cursor);
outPara.Direction = ParameterDirection.Output;
dt = db.ExecuteDataSet(oracle_command).Tables[0];
}
catch (Exception get_all_provicese_error) { } return dt;
}
( USERNAME IN VARCHAR2,
TENANTPASSWORD IN VARCHAR2,
cRecSet OUT SYS_REFCURSOR
)
AS
sqlQuery varchar2(3000);
BEGIN
sqlQuery:= 'SELECT TenantID from TenantProfile
where
Username='|| USERNAME ||' AND TenantPassword='|| TENANTPASSWORD;
OPEN cRecSet FOR sqlQuery;
END;
-- below shows code behind the C# app.
public static DataTable getAllPRovinces()
{
DataTable dt = new DataTable();
dt = null;
try
{
Database db = DatabaseFactory.CreateDatabase("oracle_db");
OracleCommand oracle_command = new OracleCommand("AUTHENTICATE_TENANT_PROFILE");
oracle_command.Parameters.Add("USERNAME",OracleType.VarChar).Value=Textbox1.Text;
oracle_command.Parameters.Add("TENANTPASSWORD",OracleType.VarChar).Value=Textbox2.Text;
oracle_command.CommandType = CommandType.StoredProcedure;
OracleParameter outPara = oracle_command.Parameters.Add("cRecSet",OracleType.Cursor);
outPara.Direction = ParameterDirection.Output;
dt = db.ExecuteDataSet(oracle_command).Tables[0];
}
catch (Exception get_all_provicese_error) { } return dt;
}
Comments
Post a Comment