我试过这段代码,但无法完成任务,请帮忙!我想找到控制并添加动态控制页面派生自母版页
public void data()
{
string connectionstring = ConfigurationManager.ConnectionStrings["LocalMySqlServer"].ConnectionString;
using (MySqlConnection con = new MySqlConnection(connectionstring))
{
con.Open();
MySqlCommand cmd = new MySqlCommand("select * from movie;", con);
MySqlDataReader dr = cmd.ExecuteReader();
if (dr.HasRows)
{
Control abc = this.FindControl("divv");
while (dr.Read())
{
if (abc != null)
{
Label lbl = new Label();
abc.Controls.Add(lbl);
lbl.Text = dr["mv_title"].ToString();
//abc.Controls.Add(new LiteralControl("<br />"));
}
}
}
}
}
哪里是代码做? –
这里是代码 – user6698813
更改您的查询从电影 –