public string[] ProductList()
{
ArrayList al = new ArrayList();
string s = "";
Database db = DatabaseFactory.CreateDatabase();
DbCommand cmd = db.GetSqlStringCommand("SELECT ProductName from Products");
DataSet ds = db.ExecuteDataSet(cmd);
foreach (DataRow dRow in ds.Tables[0].Rows)
{
al.Add(dRow);
}
foreach (Object row in al)
{
s = s + ((DataRow)row)["ProductName"].ToString() + ",";
}
string rawString = s.TrimEnd(',').ToString();
string[] result = rawString.Split(',');
return result;
}
then you can bind this array to Gridview
Gridview1.DataSource=ProductList();
Gridview1.Bind();