Is it possible to pass an array from a method?
An example below:
Code:array GetArray() { SqlConnection conn = new SqlConnection("Server=127.0.0.1;User ID=me;Pwd=dude;database=mine;); SqlDataReader rdr = null; conn.Open(); SqlCommand cmd = new SqlCommand("select * from Table", conn); rdr = cmd.ExecuteReader(); string[,] names = new string[cnt,6]; //creates a two dimensional array rdr.Read(); //initial read for (int i=1; i < cnt; i++) { for (int j=1; j < 6; j++) { names[i,j] = rdr[j].ToString(); } rdr.Read(); } conn.Close(); return names }




Reply With Quote