Click here to Skip to main content
15,888,461 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I had Tried the following coding:

C#
 ArrayList obj = new ArrayList();
          insert_pro insobj= new insert_pro();
           OracleCommand cmd = new OracleCommand("ins1", conn);
           cmd.CommandType = CommandType.StoredProcedure;
           OracleParameter emp_obj = new OracleParameter();
        for (int i = 0; i < arr_id.Count; i++)
          {

            insobj._Id = Convert.ToInt16(arr_id[i].ToString());
            insobj._Name = arr_name[i].ToString();
            insobj._Gender= arr_gender[i].ToString();
 emp_obj.OracleDbType = OracleDbType.Object;
            emp_obj.Direction = ParameterDirection.Input;
            emp_obj.Size = arr_len;
            emp_obj.UdtTypeName = "SMP_EMP_TYPE";
            emp_obj.Value = insobj;
              obj.Add(emp_obj);
}

here am able to store parameters values into array list but it stores the last emp_obj.value to all parameters....
Posted
Updated 3-May-12 1:06am
v3

1 solution

Hi
Move this line inside the loop. Actually you are overwriting the values, not creating new one. Thats why you are getting last value for all parameters.

C#
insert_pro insobj= new insert_pro();
 
Share this answer
 
Comments
kevin_ze 3-May-12 7:31am    
Thank u...
using ur idea only I have done that one bt I moved
OracleParameter emp_obj = new OracleParameter(); into loop...
now its working...
Again thanks for ur solution....

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