我正在创建一个网站,我一次检索多条记录。我必须将这些记录保存在某个地方,以便以后可以在转发器控件中显示它们。那么有没有办法保存它们。数组无法使用,因为它们不会使代码通用,我希望它更通用
string query = @"select friend_id from selfify.user where email=('" + email + "');";
MySqlConnection ms = new MySqlConnection(connection);
MySqlCommand cmd = new MySqlCommand(query, ms);
ms.Open();
MySqlReader r= new MySqlReader();
r=cmd.executeQuery();
while(r.Read()){
friend_id= r["friend_id"].ToString(); //if there are multiple records they
// cant be store in a variable
}
Repeater1.DataSource = friend_id;
Repeater1.DataBind();
ms.Close();