Wednesday, February 26, 2014

System.IndexOutOfRangeException



public static Customer GetCustomer(int idCallActionItem)
{
Customer result = new Customer();

SqlCommand cmd = new SqlCommand("GetCustomer");
cmd.CommandType = CommandType.StoredProcedure;

SqlParameter param1 = new SqlParameter("@idCallActionItem", SqlDbType.Int);
param1.Value = idCallActionItem;

cmd.Parameters.Add(param1);


SqlDataReader reader = Database.ReturnExecuteReader(cmd);

if (reader.Read())
{






result.IdCustomer = Convert.ToInt32(reader["IdCustomer"].ToString());
result.Surname = reader["Surname"].ToString();
result.Name = reader["Name"].ToString();
result.Street = reader["Street"].ToString();
//result.Nasl = reader["Naslov1"].ToString(); //error





Additional information: Naslov1



Naslov1 is same table as Street. I dont know why i get error if someone can explain to me why i get error



and how can i fix it. Thx for your answers.

No comments:

Post a Comment