Suppose You are getting data in DataSet DataTable and you want to get /copy that data from the particular DataTable’s specific Columnn contents to ArrayList then you need to do following steps.
DataSet dsFields = new DataSet();
string strQry = @” SELECT * FROM XYZ”;
// Settings.ConnectionString is where the Connection String is stored. dsFields = OracleHelper.ExecuteDataset(Settings.ConnectionString, CommandType.Text, strQry);
ArrayList arrProperties = new ArrayList();
foreach (DataRow row in dsFields.Tables[0].Rows) {
arrProperties.Add(row[“REQUIRED_COLUMN_NAME”]);
}
You will get ArrayList ‘arrProperties’ filled with the data of Column REQUIRED_COLUMN_NAME of Table[0]
Also If you want to Copy the same contents to Array from ArrayList then
string[] PropertiesArray = (string[])arrProperties.ToArray(typeof(string));
Here we are using string[])arrProperties.ToArray(typeof(string) because we are copying to Array of type string[] so need to be casted with string[] and need to mention the Type of the location to be copied.