So I have this code that fetches my query.
public class Person
{
public string Ad_Name { get; set; }
}
public string[] getNameAd(string username)
{
List<String> columnData = new List<String>();
//var AdNameList = new List<Person>();
this.OpenConnection();
string query = "SELECT `Ad_Name` FROM `cpcboos1_textinfo`.`Ad_Info` WHERE `Ad_Info`.`User` = '" + username + "' LIMIT 0, 1000";
MySqlCommand cmd = new MySqlCommand(query, connection);
using (var reader = cmd.ExecuteReader())
{
while (reader.Read())
{
columnData.Add(reader.GetString(0));
}
}
return columnData.ToList<string>().ToArray();
}
I reference this code in my Load function on my Main Form.
DBConnect sql = new DBConnect(" *snip* ");
stat_campaign.Items.AddRange(sql.getNameAd(tbx_lgn_user.ToString().Trim()));
However all this returns is the text: "(Collection)". That's it. I ran the query on the SQL databse and it returns the correct results. (Just two of them for now.) What am I doing wrong?