Click here to Skip to main content
15,892,517 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
XML
<pre lang="sql">else
   {
       //str.Append(o_Qry_Security.qry_UpdateGroupID_UserRightsMaster(User_Master_ID, Convert.ToInt32(SessionCheck.s_sessionusergroupid))); // COMMENTED ON 29-07 Vinodita
     o_Qry_Security.qry_UpdateGroupID_UserRightsMaster(User_Master_ID,t_MAKERDATETIME, Convert.ToInt32(SessionCheck.s_sessionusergroupid));
   }</pre>





public void qry_UpdateGroupID_UserRightsMaster(int usermasterinternalid, string MAKERDATETIME,int makerid)
{
//StringBuilder strBuilder = new StringBuilder();
//strBuilder.Append(" UPDATE USER_RIGHTS_MASTER ");
//strBuilder.Append(" SET ");
//strBuilder.Append(" MAKER_ID =:makerid , ");
//strBuilder.Append(" MAKER_DATETIME = TO_DATE(:MAKERDATETIME, 'DD-MM-YYYY') WHERE ID =: usermasterinternalid ");


//s_dsnstr = o_Cls_Utility.utl_fnGetDSNStr(SessionCheck.s_sessiondpid);
//OracleConnect o_Cls_OracleConnect = new OracleConnect(s_dsnstr);
//o_Cls_OracleConnect.OracleCommand_PreInit(strBuilder.ToString());

//o_Cls_OracleConnect.Parameter_Int32("MAKER_ID", makerid);
//o_Cls_OracleConnect.Parameter_String("MAKERDATETIME", MAKERDATETIME);
//o_Cls_OracleConnect.Parameter_Int32("usermasterinternalid", usermasterinternalid);




//o_Cls_OracleConnect.ExecNonQuery();
//strBuilder.Remove(0, strBuilder.Length);



StringBuilder strBuilder = new StringBuilder();
strBuilder.Append(" UPDATE USER_RIGHTS_MASTER ");
strBuilder.Append(" SET ");
strBuilder.Append(" MAKER_ID =:makerid , ");
strBuilder.Append(" MAKER_DATETIME = TO_DATE(:MAKERDATETIME, 'DD-MM-YYYY') WHERE ID =: usermasterinternalid ");


s_dsnstr = o_Cls_Utility.utl_fnGetDSNStr(SessionCheck.s_sessiondpid);
OracleConnect o_Cls_OracleConnect = new OracleConnect(s_dsnstr);
o_Cls_OracleConnect.OracleCommand_PreInit(strBuilder.ToString());

o_Cls_OracleConnect.Parameter_Int32("MAKER_ID", makerid);
o_Cls_OracleConnect.Parameter_String("MAKERDATETIME", MAKERDATETIME);
o_Cls_OracleConnect.Parameter_Int32("usermasterinternalid", usermasterinternalid);


o_Cls_OracleConnect.ExecNonQuery();
strBuilder.Remove(0, strBuilder.Length);


}

C#
public void ExecNonQuery()
      {
          try
          {
              MyCmd.Transaction = MyTrans;
              MyCmd.ExecuteNonQuery();
          }
          catch (Exception ex)
          {
              MyTrans.Rollback();
              throw ex;
          }
          finally
          {
              if (!(MyCmd == null))
              {
                  MyCmd.Dispose();
              }
              MyCmd = null;
          }
      }



I get an error at catch statement :ORA-01036: illegal variable name/number
Posted
Updated 16-Mar-16 19:52pm
v2

The problem is here!

o_Cls_OracleConnect.Parameter_Int32("MAKER_ID", makerid);


at this point you are declaring a parameter named :makerid but at the time of parameter creation you are creating it as MAKER_ID.

strBuilder.Append(" MAKER_ID =:makerid , ");


To fix this issue do this

<pre>o_Cls_OracleConnect.Parameter_Int32("makerid", makerid);
 
Share this answer
 
Comments
Member 9410081 2-Aug-13 3:57am    
Thanks.. I will chk out
Member 9410081 2-Aug-13 4:02am    
Its working...Thanks....
Quote:
This error occurs when the parameters are not properly passed to the SQLDatasource or Command object when connecting to Oracle Database using System.Data.OracleClient.


For more info check this :

http://www.aspsnippets.com/Articles/Exception---ORA-01036-illegal-variable-namenumber.aspx[^]

and this :

http://forums.asp.net/t/1244079.aspx/1[^]

I hope this will help to you.
 
Share this answer
 
Comments
Member 9410081 2-Aug-13 3:35am    
Thanks.. i will chk out.
Member 9410081 2-Aug-13 3:38am    
Still din get proper solution.
Sampath Lokuge 2-Aug-13 3:46am    
Plz remove commented code in your question and put only the current code which you're having problem.

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