Click here to Skip to main content
15,922,325 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,




Iam getting error when i try to insert some data to oracle store procedure from winforms
Actually iam getting error like 'OracleParameter.Value is invalid'

My code is


public static DataTable SaveAndGetSectionPAR(TANInfo tanInfo)
{
DataTable dtPARs = null;
try
{
using (OracleConnection oraCon = DataConnection.GetOracleConnection())
{
using (OracleCommand oraCmd = new OracleCommand())
{
oraCmd.Connection = oraCon;
oraCmd.CommandText = "SAVE_SECTION_PAR";
oraCmd.CommandType = CommandType.StoredProcedure;
oraCmd.Parameters.Add("PIN_SEC_ID", OracleDbType.Int32).Value = tanInfo.SectionID;

OracleParameter paPARText = new OracleParameter();
paPARText.ParameterName = "PIC_PAR_TEXT";
paPARText.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
paPARText.OracleDbType = OracleDbType.Varchar2;
paPARText.Size = tanInfo.PAR_Text.Count;
paPARText.Value = tanInfo.PAR_Text;
oraCmd.Parameters.Add(paPARText);

OracleParameter paPar = new OracleParameter();
paPar.ParameterName = "PIC_PAR_RTF";
paPar.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
paPar.OracleDbType = OracleDbType.Varchar2;
paPar.Size = tanInfo.PAR_Rtf.Count;
paPar.Value = tanInfo.PAR_Rtf;
oraCmd.Parameters.Add(paPar);

oraCmd.Parameters.Add("PIN_UR_ID", OracleDbType.Int32).Value = tanInfo.UserRoleID;
oraCmd.Parameters.Add("PORC_SEC_PARS", OracleDbType.RefCursor).Direction = ParameterDirection.Output;
dtPARs = new DataTable();
OracleDataAdapter oraAdpt = new OracleDataAdapter(oraCmd);
oraAdpt.Fill(dtPARs);
}
}
}
catch (Exception ex)
{
throw ex;
}
return dtPARs;
}
Posted
Comments
Bernhard Hiller 8-Nov-13 2:58am    
"getting error like ..." - no, that's not the correct way. Give us the complete error message, and tell us the line where error happens.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900