public ArrayList selectAllAsArrayList() { string connectionString = "Data Source=(LocalDB)\\v11.0;AttachDbFilename=C:\\Users\\Jose\\Documents\\WAM.mdf;Integrated Security=True;Connect Timeout=30"; string queryString = "SELECT * FROM Vertex;"; SqlConnection connection = new SqlConnection(connectionString); SqlCommand command = new SqlCommand(queryString, connection); connection.Open(); SqlDataReader reader = command.ExecuteReader(); ArrayList vertices = new ArrayList(); while (reader.Read()) { string name = (string)reader["name"]; string label = (string)reader["label"]; int idInt = (int)reader["id"]; int xInt = (int)reader["x"]; int yInt = (int)reader["y"]; int widthInt = (int)reader["width"]; int heightInt = (int)reader["height"]; wam.Vertex v = new wam.Vertex(idInt, name, label, xInt, yInt, widthInt, heightInt); vertices.Add(v); } connection.Close(); return(vertices); }
public ArrayList selectAllAsArrayList() { string connectionString = "Data Source=(LocalDB)\\v11.0;AttachDbFilename=C:\\Users\\Jose\\Documents\\WAM.mdf;Integrated Security=True;Connect Timeout=30"; string queryString = "SELECT * FROM Vertex;"; SqlConnection connection = new SqlConnection(connectionString); SqlCommand command = new SqlCommand(queryString, connection); connection.Open(); SqlDataReader reader = command.ExecuteReader(); ArrayList vertices = new ArrayList(); while (reader.Read()) { string name = (string)reader["name"]; string label = (string)reader["label"]; int idInt = (int)reader["id"]; int xInt = (int)reader["x"]; int yInt = (int)reader["y"]; int widthInt = (int)reader["width"]; int heightInt = (int)reader["height"]; wam.Vertex v = new wam.Vertex(idInt, name, label, xInt, yInt, widthInt, heightInt); vertices.Add(v); } connection.Close(); return vertices; }