求 c#/.NET滚动代码,我想读取数据库的多行数据,然后在控件自动滚动
我写的方法老是只显示第一条在循环滚动publicvoidExceRead(){SqlConnectioncon=newSqlConnection(Configuratio...
我写的方法老是只显示第一条在循环滚动
public void ExceRead()
{
SqlConnection con = new SqlConnection(ConfigurationSettings.AppSettings["ConStr"]);
con.Open();
string SqlStr = "select top 5 neirong from tb_zhannei";
SqlCommand cmd = new SqlCommand(SqlStr, con);
SqlDataReader sdr = cmd.ExecuteReader();
sdr.Read();
Label1.Text = sdr.GetString(0) ;
}
<marquee direction=up onmouseover=this.stop() onmouseout=this.start()
style="width: 99%; height: 212px; margin-top: 1px; scrollamount="1" scrolldelay="30" ">
<asp:Label id="Label1" runat="server" ForeColor="Black"
Font-Size="x-large" Font-Bold="False" Font-Names="宋体">
</asp:Label></marquee> 展开
public void ExceRead()
{
SqlConnection con = new SqlConnection(ConfigurationSettings.AppSettings["ConStr"]);
con.Open();
string SqlStr = "select top 5 neirong from tb_zhannei";
SqlCommand cmd = new SqlCommand(SqlStr, con);
SqlDataReader sdr = cmd.ExecuteReader();
sdr.Read();
Label1.Text = sdr.GetString(0) ;
}
<marquee direction=up onmouseover=this.stop() onmouseout=this.start()
style="width: 99%; height: 212px; margin-top: 1px; scrollamount="1" scrolldelay="30" ">
<asp:Label id="Label1" runat="server" ForeColor="Black"
Font-Size="x-large" Font-Bold="False" Font-Names="宋体">
</asp:Label></marquee> 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励10(财富值+成长值)+提问者悬赏5(财富值+成长值)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询