private void LoadUserControls(string cmd) { OracleConnection myConnection = Db.Connection(); myConnection.Open(); OracleCommand myCommand = myConnection.CreateCommand(); myCommand.CommandText = cmd; OracleDataReader reader = myCommand.ExecuteReader(); int top = 10; while (reader.Read()) { Accommodation data = new Accommodation { AID = (decimal)reader["AID"], AName = reader["AName"].ToString(), Address = reader["STREET"].ToString() + ", " + reader["CITY"].ToString() + ", " + reader["REGION"].ToString(), Description = reader["DESCRIPTION"].ToString(), PhoneNo = reader["PHONE"].ToString(), Email = reader["EMAIL"].ToString() }; var myUserControl = new Uc_ViewAccommodations { Top = top, Left = 35, data = data }; myUserControl.DataBind(); top = top + myUserControl.Height + 10; pn_Container.Controls.Add(myUserControl); } reader.Close(); myConnection.Close(); }
private void LoadUserControls(string cmd) { OracleConnection myConnection = Db.Connection(); myConnection.Open(); OracleCommand myCommand = myConnection.CreateCommand(); myCommand.CommandText = cmd; OracleDataReader reader = myCommand.ExecuteReader(); int top = 10; while (reader.Read()) { Accommodation data = new Accommodation(); data.AID = (decimal)reader["AID"]; data.AName = reader["AName"].ToString(); data.Address = reader.GetString(2) + ", " + reader.GetString(3) + ", " + reader.GetString(4); data.Description = reader.GetString(5); data.PhoneNo = reader.GetString(6); data.Email = reader.GetString(7); var myUserControl = new Uc_Accommodations(); myUserControl.Top = top; myUserControl.Left = 35; myUserControl.data = data; myUserControl.DataBind(); top = top + myUserControl.Height + 10; pn_Container.Controls.Add(myUserControl); } reader.Close(); myConnection.Close(); }