So we need to convert these into unified data type such as string or string array.
public string[] RecordAll()
{
SqlConnection con = new SqlConnection("Server=Your server\\SQLExpress;Database=SPTest; Trusted_Connection=Yes");
con.Open();
DataSet ds = new DataSet();
ArrayList al = new ArrayList();
SqlCommand cmd = new SqlCommand("Select * from Registers",con);
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
adapter.Fill(ds, "Registers");
foreach (DataRow row in ds.Tables[0].Rows)
{
al.Add(row[0]);
al.Add(row[1]);
}
string[] stringArray = (string[])al.ToArray(typeof(string));
return stringArray;
}