本文整理汇总了C#中OracleParameter类的典型用法代码示例。如果您正苦于以下问题:C# OracleParameter类的具体用法?C# OracleParameter怎么用?C# OracleParameter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OracleParameter类属于命名空间,在下文中一共展示了OracleParameter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InsertNewProduct
public int InsertNewProduct(string commandString, string name, decimal price, int vendor, int measure, int category)
{
int result = -1;
OracleParameter parameterName = new OracleParameter(":name", name);
OracleParameter parameterPrice = new OracleParameter(":price", price);
OracleParameter parameterVendor = new OracleParameter(":vendor", vendor);
OracleParameter parameterMeasure = new OracleParameter(":measure", measure);
OracleParameter parameterCategory = new OracleParameter(":category", category);
OracleNotSelectConnection notSelectConnection = null;
try
{
using (notSelectConnection = new OracleNotSelectConnection())
{
result = notSelectConnection.UpdateDatabase(commandString,
new OracleParameter[] { parameterName, parameterPrice, parameterVendor, parameterMeasure, parameterCategory });
}
}
catch (Exception ex)
{
if (notSelectConnection != null)
{
notSelectConnection.Dispose();
notSelectConnection = null;
}
throw ex;
}
return result;
}
示例2: ConvertToNativeParameter
private static IDbDataParameter ConvertToNativeParameter(DbParameter dbParameter, CommandType cmdType)
{
IDbDataParameter clone = new OracleParameter() { IsNullable = dbParameter.IsNullable };
// Remove leading ':' character for stored procedures.
if (cmdType == CommandType.StoredProcedure)
{
string name = parameterRenderer.RenderParameterName(dbParameter);
if (name.StartsWith(":", StringComparison.Ordinal))
name = name.Substring(1, name.Length - 1);
clone.ParameterName = name;
}
else
{
clone.ParameterName = parameterRenderer.RenderParameterName(dbParameter);
}
if (dbParameter.PassMode == SpArgumentPassMode.DataTableFilledByAdapter)
((OracleParameter)clone).OracleDbType = OracleDbType.RefCursor;
else
clone.DbType = dbParameter.DbType;
clone.Direction = dbParameter.Direction;
clone.Precision = dbParameter.Precision;
clone.Scale = dbParameter.Scale;
clone.Size = dbParameter.Size;
clone.SourceColumn = dbParameter.SourceColumn;
clone.SourceVersion = dbParameter.SourceVersion;
clone.Value = dbParameter.Value;
return clone;
}
示例3: updatePlayer
//TEMPORAIRE VERIFIER Si jid ou USERNAME
public static bool updatePlayer(int jid, string username, string email, string password)
{
OracleConnection conn = Connection.getInstance().conn;
string sqlupdate = "update joueurs set email=:EMAIL,Hash_KEY=:Hash_KEY where jid=:jid";
try
{
OracleCommand oraUpdate = new OracleCommand(sqlupdate, conn);
OracleParameter OraParamEmail = new OracleParameter(":EMAIL", OracleDbType.Varchar2, 40);
OracleParameter OraParamHashKey = new OracleParameter(":Hash_KEY", OracleDbType.Char, 75); //Ajout
OracleParameter OraParamJid = new OracleParameter(":jid", OracleDbType.Int32);
OraParamEmail.Value = email;
OraParamHashKey.Value = Controle.hashPassword(password, null, System.Security.Cryptography.SHA256.Create());
OraParamJid.Value = jid;
oraUpdate.Parameters.Add(OraParamEmail);
oraUpdate.Parameters.Add(OraParamHashKey);
oraUpdate.Parameters.Add(OraParamJid);
oraUpdate.ExecuteNonQuery();
return true;
}
catch (OracleException ex)
{
Erreur.ErrorMessage(ex);
return false;
}
}
示例4: insertPlayer
//-------------------------------------INSERT / UPDATE / DELETE PLAYER-------------------------------------------
/// <summary>
/// Fonction qui sert à insérer un joueur dans la BD
/// </summary>
/// <param name="username"></param>
/// <param name="email"></param>
/// <param name="password"></param>
/// <returns> true ou false si l'ajout marche ou pas</returns>
public static bool insertPlayer(string username, string email, string password)
{
OracleConnection conn = Connection.getInstance().conn;
string sqlAjout = "insert into joueurs (username,EMAIL,Hash_KEY)" +
" VALUES(:username,:EMAIL,:Hash_KEY)";
try
{
OracleCommand oraAjout = new OracleCommand(sqlAjout, conn);
OracleParameter OraParaUsername = new OracleParameter(":username", OracleDbType.Varchar2, 40);
OracleParameter OraParamEmail = new OracleParameter(":EMAIL", OracleDbType.Varchar2, 40);
OracleParameter OraParamHashKey = new OracleParameter(":Hash_KEY", OracleDbType.Char, 75); //Ajout
OraParaUsername.Value = username.ToLower();
OraParamEmail.Value = email;
OraParamHashKey.Value = Controle.hashPassword(password, null, System.Security.Cryptography.SHA256.Create());
oraAjout.Parameters.Add(OraParaUsername);
oraAjout.Parameters.Add(OraParamEmail);
oraAjout.Parameters.Add(OraParamHashKey);
oraAjout.ExecuteNonQuery();
return true;
}
catch (OracleException ex)
{
Erreur.ErrorMessage(ex);
return false;
}
}
示例5: InsertProductCategory
public int InsertProductCategory(string commandString, string categoryName, string categoryValue, string parentName, string parentValue)
{
int result = -1;
OracleNotSelectConnection notSelectConnection = null;
OracleParameter insertParameter = new OracleParameter(categoryName, categoryValue);
OracleParameter parentParameter = new OracleParameter(parentName, parentValue);
if (parentValue == string.Empty)
{
parentParameter.Value = System.DBNull.Value;
}
try
{
using (notSelectConnection = new OracleNotSelectConnection())
{
result = notSelectConnection.UpdateDatabase(commandString, new OracleParameter[] { insertParameter, parentParameter });
}
}
catch (Exception ex)
{
if (notSelectConnection != null)
{
notSelectConnection.Dispose();
notSelectConnection = null;
}
throw ex;
}
return result;
}
示例6: f_del_psst_person
public static string f_del_psst_person(string strPersonID)
{
string ret = "";
try
{
string cmd = "update psst_person set per_status='2',per_id_dpis=null where per_id_dpis=" + f_genField(strPersonID, "N");
ret = OPMOracleDb.ExecuteNonQuery(cmd).ToString();
if (ret.ToLower() == "true") {
ret = OPMSqlDb.ExecuteNonQuery(cmd).ToString().ToLower();
cmd = " select nvl(per_name,'') || ' ' || nvl(per_surname) person_name from per_personal where per_id=:PER_ID ";
OracleParameter[] p = new OracleParameter[1];
p[0] = DPISOracleDb.setNumber(":PER_ID", Convert.ToInt64(strPersonID));
DataTable dt = DPISOracleDb.ExecuteTable(cmd, p);
if (dt.Rows.Count > 0)
{
DLLLogFile.AddInterfaceLog("DPIS", "OPM", "per_personal", dt.Rows[0]["person_name"].ToString() + "(per_id =" + strPersonID + ")", "Interface P0101 ข้อมูลข้าราชการ/ลูกจ้างประจำ/พนักงานราชการ > ลบข้อมูล to OPM");
DLLLogFile.AddInterfaceLog("DPIS", "OPM_BO", "per_personal", dt.Rows[0]["person_name"].ToString() + "(per_id =" + strPersonID + ")", "Interface P0101 ข้อมูลข้าราชการ/ลูกจ้างประจำ/พนักงานราชการ > ลบข้อมูล to OPM_BO");
}
}
}
catch (Exception ex) { }
return ret;
}
示例7: ADO_NET_Example
static void ADO_NET_Example()
{
var cs = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=www.machinejar.com)(PORT=1522)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=devorc02)));User Id=hr;Password=hr;";
OracleConnection con = new OracleConnection();
con.ConnectionString = cs;
con.Open();
OracleCommand cmd = con.CreateCommand();
cmd.CommandText = "HR_DEPTPERCOUNTRY";
cmd.CommandType = System.Data.CommandType.StoredProcedure;
OracleParameter orcParam = new OracleParameter("CNTR_CD", OracleDbType.Varchar2);
orcParam.Size = 50;
orcParam.Value = "UK";
orcParam.Direction = System.Data.ParameterDirection.Input;
cmd.Parameters.Add(orcParam);
OracleParameter orcOutParam = new OracleParameter("RS_CURSOR", OracleDbType.RefCursor);
orcOutParam.Size = 50;
orcOutParam.Direction = System.Data.ParameterDirection.Output;
cmd.Parameters.Add(orcOutParam);
cmd.ExecuteNonQuery();
OracleDataReader reader = ((OracleRefCursor)cmd.Parameters["RS_CURSOR"].Value).GetDataReader();
while (reader.Read())
{
Console.WriteLine("Dept Name: {0} | Address: {1}, | Country: {2}", reader.GetString(0), reader.GetString(1), reader.GetString(2));
}
}
示例8: adicionarProfesional
public void adicionarProfesional(string idProfesional,string passwordProfesional,string nombreProfesional,string apellidosProfesional,string cedulaProfesional ,string correoProfesional ,string areaProfesional)
{
base.abrirConexion();
OracleCommand cmd = new OracleCommand();
cmd.Connection = conexion;
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.CommandText = "profesionales_paquete.adicionarProfesional";
OracleParameter idProfesionalP = new OracleParameter("idProfesional", OracleDbType.Varchar2, System.Data.ParameterDirection.Input);
idProfesionalP.Value = idProfesional;
OracleParameter passwordProfesionalP = new OracleParameter("passwordProfesional", OracleDbType.Varchar2, System.Data.ParameterDirection.Input);
passwordProfesionalP.Value = passwordProfesional;
OracleParameter nombreProfesionalP = new OracleParameter("nombreProfesional", OracleDbType.Varchar2, System.Data.ParameterDirection.Input);
nombreProfesionalP.Value = nombreProfesional;
OracleParameter apellidosProfesionalP = new OracleParameter("apellidosProfesional", OracleDbType.Varchar2, System.Data.ParameterDirection.Input);
apellidosProfesionalP.Value = apellidosProfesional;
OracleParameter cedulaProfesionalP = new OracleParameter("cedulaProfesional", OracleDbType.Varchar2, System.Data.ParameterDirection.Input);
cedulaProfesionalP.Value = cedulaProfesional;
OracleParameter correoProfesionalP = new OracleParameter("correoProfesional", OracleDbType.Varchar2, System.Data.ParameterDirection.Input);
correoProfesionalP.Value = correoProfesional;
OracleParameter areaProfesionalP = new OracleParameter("areaProfesional", OracleDbType.Varchar2, System.Data.ParameterDirection.Input);
areaProfesionalP.Value = areaProfesional;
cmd.Parameters.AddRange(new OracleParameter[] { idProfesionalP, passwordProfesionalP, nombreProfesionalP, apellidosProfesionalP, cedulaProfesionalP, correoProfesionalP, areaProfesionalP });
cmd.ExecuteNonQuery();
cmd.Dispose();
base.cerrarConexion();
}
示例9: buscarProfesional
public List<Profesional> buscarProfesional(string valorBusqueda)
{
base.abrirConexion();
OracleCommand cmd = new OracleCommand();
cmd.Connection = conexion;
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.CommandText = "profesionales_paquete.buscarProfesional";
OracleParameter valorBusquedaP = new OracleParameter("valorBusqueda", OracleDbType.Varchar2, System.Data.ParameterDirection.Input);
valorBusquedaP.Value = valorBusqueda;
OracleParameter cursor_datos = new OracleParameter("cursor_datos", OracleDbType.RefCursor, System.Data.ParameterDirection.Output);
cmd.Parameters.AddRange(new OracleParameter[] { valorBusquedaP, cursor_datos});
List<Profesional> profesionalesConsulta = new List<Profesional>();
OracleDataReader lectorDatos = cmd.ExecuteReader();
if (lectorDatos.HasRows)
{
while (lectorDatos.Read())
{
profesionalesConsulta.Add(new Profesional()
{
id = lectorDatos.GetString(0),
password = lectorDatos.GetString(1),
nombre = lectorDatos.GetString(2),
apellidos = lectorDatos.GetString(3),
cedula = lectorDatos.GetString(5),
correo = lectorDatos.GetString(6),
area = lectorDatos.GetString(7)
});
}
lectorDatos.Close();
cmd.Dispose();
base.cerrarConexion();
}
return profesionalesConsulta;
}
示例10: AddParticipantToConversation
public override void AddParticipantToConversation(User participant, Conversation conversation)
{
try
{
OracleCommand command = CreateCommand("insertar_Usuario_Grupo");
OracleParameter[] parameters = new OracleParameter[]
{
new OracleParameter("id_usuarioV", OracleDbType.Int32) { Value = participant.ID },
new OracleParameter("id_grupoV", OracleDbType.Int32) { Value = conversation.ID }
};
command.Parameters.Add(parameters);
_connection.Open();
command.ExecuteReader();
}
catch (Exception e)
{
throw e;
}
finally
{
_connection.Close();
}
}
示例11: UpdateDataBase
private int UpdateDataBase(string commandString, OracleParameter[] parameters)
{
OracleNotSelectConnection notSelectConnection = null;
int result = -1;
try
{
using (notSelectConnection = new OracleNotSelectConnection())
{
result = notSelectConnection.UpdateDataBase(commandString, parameters);
}
}
catch (Exception ex)
{
if (notSelectConnection != null)
{
notSelectConnection.Dispose();
notSelectConnection = null;
}
throw ex;
}
return result;
}
示例12: agregarNoticia
public void agregarNoticia(string fecha_expiracionN, string contenidoN,string encabezadoN,string tituloN)
{
base.abrirConexion();
OracleCommand cmd = new OracleCommand();
cmd.Connection = conexion;
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.CommandText = "noticias_paquete.agregarNoticia";
OracleParameter fechaExpiracionP = new OracleParameter("fecha_expiracionN", OracleDbType.Varchar2, System.Data.ParameterDirection.Input);
fechaExpiracionP.Value = fecha_expiracionN;
OracleParameter contenidoP = new OracleParameter("contenidoN", OracleDbType.Varchar2, System.Data.ParameterDirection.Input);
contenidoP.Value = contenidoN;
OracleParameter encabezadoP = new OracleParameter("encabezadoN", OracleDbType.Varchar2, System.Data.ParameterDirection.Input);
encabezadoP.Value = encabezadoN;
OracleParameter tituloP = new OracleParameter("tituloN", OracleDbType.Varchar2, System.Data.ParameterDirection.Input);
tituloP.Value = tituloN;
cmd.Parameters.AddRange(new OracleParameter[] { fechaExpiracionP, contenidoP, encabezadoP, tituloP});
cmd.ExecuteNonQuery();
cmd.Dispose();
base.cerrarConexion();
}
示例13: inicioSesion
public SesionUsuario inicioSesion(string userCorreo, string userPassword, string tipoUsuario)
{
base.abrirConexion();
OracleCommand cmd = new OracleCommand();
cmd.Connection = conexion;
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.CommandText = "pk_usuarios.session_login";
OracleParameter userCorreoP = new OracleParameter("correoLogin", OracleDbType.Varchar2, System.Data.ParameterDirection.Input);
userCorreoP.Value = userCorreo;
OracleParameter userPasswordP = new OracleParameter("passwordLogin", OracleDbType.Varchar2, System.Data.ParameterDirection.Input);
userPasswordP.Value = userPassword;
//cmd.Parameters.Add("co", OracleDbType.RefCursor).Direction = System.Data.ParameterDirection.Output;
OracleParameter tipoUsuarioP = new OracleParameter("rol", OracleDbType.Varchar2, System.Data.ParameterDirection.Input);
tipoUsuarioP.Value = tipoUsuario;
OracleParameter resultado = new OracleParameter("resultado", OracleDbType.RefCursor, System.Data.ParameterDirection.Output);
cmd.Parameters.AddRange(new OracleParameter[] { userCorreoP, userPasswordP, tipoUsuarioP, resultado });
OracleDataReader lectorDatos = cmd.ExecuteReader();
if (lectorDatos.HasRows)
{
lectorDatos.Read();
return new SesionUsuario() { id = lectorDatos.GetString(0), operacionExitosa = true, rol = tipoUsuario };
}
else
return new SesionUsuario() { id = string.Empty, operacionExitosa = false, rol = tipoUsuario };
}
示例14: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
var cookielist = sm.GetCartFromCookie();
if(cookielist != null)
{
Cart.Text = "Cart: " + cookielist.Count().ToString() + " product(s)";
if (cookielist.Count() > 0)
{
foreach (var product in cookielist)
{
OracleParameter[] parameterList = new OracleParameter[]
{
new OracleParameter("serienumber",product.ProductId)
};
DataTable DT = db.ExecuteReadQuery("SELECT * FROM PRODUCT WHERE SERIE_NUMBER = :serienumber", parameterList);
foreach (DataRow DR in DT.Rows)
{
ProductListControl productListControl = LoadControl("~/controls/ProductListControl.ascx") as ProductListControl;
productListControl.Name = DR["NAME"].ToString();
productListControl.ItemNumber = DR["SERIE_NUMBER"].ToString();
productListControl.Price = DR["PRICE"].ToString();
productListControl.ImagePath = DR["IMAGE_PATH"].ToString();
productListControl.Id = DR["ID"].ToString();
products.Controls.Add(productListControl);
}
}
}
}
}
示例15: CreerCommandeCliente
/// <summary>
/// Créé la commande. Ne permet pas le remplissage des médicaments.
/// </summary>
/// <param name="oMsg"></param>
/// <returns></returns>
public STR_MSG CreerCommandeCliente(STR_MSG oMsg)
{
char status = '1'; // commande OK
char prescription = '0'; // commande sans prescription
char hasRead = '1'; //
int prescription_id = 1;
int patientID = (int)oMsg.Data[1];
OracleCommand cmd = new OracleCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "PHARMAWEB.Create_Commande";
OracleParameter RV = new OracleParameter();
RV.Direction = ParameterDirection.ReturnValue; // indique si c'est un paramètre entrant, ou de retour
RV.OracleDbType = OracleDbType.Int32;
RV.ParameterName = "id";
cmd.Parameters.Add(RV);
cmd.Parameters.Add("statut", OracleDbType.Char).Value = status;
cmd.Parameters.Add("prescription", OracleDbType.Char).Value = prescription;
cmd.Parameters.Add("hasRead", OracleDbType.Char).Value = hasRead;
cmd.Parameters.Add("prescription_id", OracleDbType.Int32, 255).Value = prescription_id;
cmd.Parameters.Add("patientID", OracleDbType.Int32, 255).Value = patientID;
this.oMsg = CL_MESSAGE_Factory.msg_factory("", new object[] { cmd }, "", "", "", true, "");
return this.oMsg;
}