G
Guest
I need to create a string array from a datareader in .net 2.0
I am using this:
ArrayList al = new ArrayList();
using (SqlDataReader dr = cmd.ExecuteReader())
{
while (dr.Read())
{
al.Add(dr.GetString(0));
}
}
string[] str = new string[al.Count - 1];
al.CopyTo(str);
return str;
Is their a better way?
I am using this:
ArrayList al = new ArrayList();
using (SqlDataReader dr = cmd.ExecuteReader())
{
while (dr.Read())
{
al.Add(dr.GetString(0));
}
}
string[] str = new string[al.Count - 1];
al.CopyTo(str);
return str;
Is their a better way?