Home / ASP.NET Wiki / HTML / Fetch data from the database and place it in a marquee

Fetch data from the database and place it in a marquee

 Rate It (1)

1. First we should take the marquee tag in the source  of our web form(Page.aspx) page like this:->

<marquee direction=”up”  onmouseover=”this.start()” onmouseout=”this.stop()”
scrolldelay=”300″ style=”height: 213px”>
<asp:Literal ID=”lt1″ runat=”server”></asp:Literal></marquee>

Note:-> literal to show the database values in the marquee

2.In Database:->

My Database Name:->db2

Create a table:->

create table news1

(

id int identity(1,1),

headings varchar(50)

);

3.Page.aspx coding:->

using System.Data.SqlClient;

SqlConnection conn1 = new SqlConnection(“data source=AB\\SQLEXPRESS;initial catalog=db2;integrated security=true”);

SqlDataAdapter da1 = new SqlDataAdapter(“select * from news1″, conn1);
DataSet ds1 = new DataSet();
da1.Fill(ds1, “news1″);
string s1;
s1 = “<table><tr><td><a href=Default3.aspx style=font-family: fantasy; font-size: small; font-weight:bold; font-style: normal; color: #660066>”;

s1 += ds1.Tables["news1"].Rows[0][1].ToString();
s1 += “</a></td>”;
s1 += “<br/>”;
s1 += “<tr><td><a href=Default2.aspx style=color: #9966FF; font-weight: bold;>”;
s1 += ds1.Tables["news1"].Rows[1][1].ToString();
s1 += “</a></td></table>”;
lt1.Text = s1.ToString();

Revision number 2, Saturday, October 30, 2010 2:52:15 PM by codenickel

Comments

i think we need to add semi-column if we are adding it into our asp.net page onmouseover="this.stop();" onmouseout="this.start();">

i am using sql 2005, aspx and vb code file in my web please guide me to go through

Shortcuts

Table of Contents

Top Wiki Contributors

(last 30 days)

  1. abiruban (1)