using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient; using System.Configuration; public partial class sldeshow : System.Web.UI.Page { static DataTable dt; static int TotalRecords, CurrentRecord; protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { string sqlconstr = "Data Source=HOME;Initial Catalog=Registration;Integrated Security=True"; SqlConnection con = new SqlConnection(sqlconstr); SqlDataAdapter sqlda = new SqlDataAdapter("select * from imagepath where CurrentDate is NULL union ALL select * from imagepath where convert(varchar(20), CurrentDate, 101) = convert(varchar(20), getdate(), 101)", con); dt = new DataTable(); sqlda.Fill(dt); TotalRecords = dt.Rows.Count; Image1.ImageUrl = "~/Upload/" + dt.Rows[0]["ImageName"].ToString(); } } protected void Timer11_Tick(object sender, EventArgs e) { CurrentRecord++; if (CurrentRecord == TotalRecords) { CurrentRecord = 0; } Image1.ImageUrl = "~/Upload/" + dt.Rows[CurrentRecord]["ImageName"].ToString(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)