2
Answers

Passing Array from a method

Sheikh parvaz

Sheikh parvaz

11y
1.6k
1
I want to return array of char to another method in code behind. But the problem is, Itz showing me problem , As I can not access the array outside the foreach loop. 
public Array passprocedures()
        {
             con.Open();
            
            string[] procs =
            {
            "Today",
            "Open",
            "Resolved",
            "Pending",
            "Closed"
          
            };
            foreach(string value in procs)
            {
               
              
                cmd = new SqlCommand(value, con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = value;
                cmd.Parameters.Add("@para", SqlDbType.NVarChar).Value = User.Identity.Name;

              char[]fcount = cmd.ExecuteScalar().ToString().ToArray();
                 
            }

            return ? ;Here is the problem. I m unable to return the array.
            con.Close();
           
        }

Answers (2)