protected void Page_Load(object sender, EventArgs e) { // Get connection string from the web.config file string connString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; // Create SqlConnection object SqlConnection sqlConn = new SqlConnection(); sqlConn.ConnectionString = connString; // SQL query to retrieve data from database string sqlQuery = "SELECT TOP 10 Id, Name, Publisher, Description FROM Project ORDER BY Id DESC"; // Create SqlCommand object SqlCommand cmd = new SqlCommand(); cmd.Connection = sqlConn; cmd.CommandType = CommandType.Text; cmd.CommandText = sqlQuery; // open connection and then binding data into RepeaterRSS control sqlConn.Open(); RepeaterRSS.DataSource = cmd.ExecuteReader(); RepeaterRSS.DataBind(); sqlConn.Close(); }
protected void Page_Init() { // Get connection string from the web.config file string connString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; // Create SqlConnection object SqlConnection sqlConn = new SqlConnection(); sqlConn.ConnectionString = connString; // SQL query to retrieve data from database string sqlQuery = "SELECT TOP 10 ArticleID, Title, Author, Url, Description, DatePublished FROM NewsFeed ORDER BY DatePublished DESC"; // Create SqlCommand object SqlCommand cmd = new SqlCommand(); cmd.Connection = sqlConn; cmd.CommandType = CommandType.Text; cmd.CommandText = sqlQuery; // open connection and then binding data into RepeaterRSS control sqlConn.Open(); RepeaterRSS.DataSource = cmd.ExecuteReader(); RepeaterRSS.DataBind(); sqlConn.Close(); }
protected void Page_Load(object sender, EventArgs e) { // Create SqlConnection object SqlConnection sqlConn = new SqlConnection("Data Source=localhost\\SQLEXPRESS;Initial Catalog=MoviesBS;Integrated Security=True;Pooling=False"); // SQL query to retrieve data from database string sqlQuery = "select * from dbo.Movies join (select top 14 id, count(*) as nPurchases from dbo.Purchases group by id order by nPurchases desc) as tmp on dbo.Movies.id = tmp.id"; // Create SqlCommand object SqlCommand cmd = new SqlCommand(sqlQuery, sqlConn); cmd.CommandType = CommandType.Text; // open connection and then binding data into RepeaterRSS control try { sqlConn.Open(); RepeaterRSS.DataSource = cmd.ExecuteReader(); RepeaterRSS.DataBind(); sqlConn.Close(); } catch { Debug.WriteLine("ERRO"); } }
protected void Page_Load(object sender, EventArgs e) { // Get connection string from the web.config file string connString = System.Configuration.ConfigurationManager.ConnectionStrings["dbcs16adlConnectionString"].ConnectionString; // Create SqlConnection object SqlConnection sqlConn = new SqlConnection(); sqlConn.ConnectionString = connString; // SQL query to retrieve data from database string sqlQuery = "SELECT TOP 10 Id, Title, Designer, Concept, DateofArtwork FROM ArtworkTest ORDER BY DateofArtwork DESC"; // Create SqlCommand object SqlCommand cmd = new SqlCommand(); cmd.Connection = sqlConn; cmd.CommandType = CommandType.Text; cmd.CommandText = sqlQuery; // open connection and then binding data into RepeaterRSS control sqlConn.Open(); RepeaterRSS.DataSource = cmd.ExecuteReader(); RepeaterRSS.DataBind(); sqlConn.Close(); }
protected void Page_Load(object sender, EventArgs e) { // Get connection string from the web.config file string connString = ConfigurationManager.ConnectionStrings["dbmt16abkConnectionString"].ConnectionString; // Create SqlConnection object SqlConnection sqlConn = new SqlConnection(); sqlConn.ConnectionString = connString; // SQL query to retrieve data from database string sqlQuery = "SELECT TOP 10 Id, Title, Author, PostDate FROM VeganRecipes ORDER BY PostDate DESC"; // Create SqlCommand object SqlCommand cmd = new SqlCommand(); cmd.Connection = sqlConn; cmd.CommandType = CommandType.Text; cmd.CommandText = sqlQuery; // open connection and then binding data into RepeaterRSS control sqlConn.Open(); RepeaterRSS.DataSource = cmd.ExecuteReader(); RepeaterRSS.DataBind(); sqlConn.Close(); }
protected void Page_Load(object sender, EventArgs e) { SqlDataAdapter da = new SqlDataAdapter("usp_GetBlogPostForRss", con); DataTable dt = new DataTable(); da.Fill(dt); RepeaterRSS.DataSource = dt; RepeaterRSS.DataBind(); // sqlConn.Close(); }
protected void Page_Load(object sender, EventArgs e) { string Command = "SELECT p.idPublicaciones, p.url, p.imagenPortada, p.titulo, p.subtitulo, p.fecha, CONCAT(u.nombres, ' ', u.apellido) as autor " + "FROM publicaciones p INNER JOIN usuarios u ON (p.idUsuarios = u.idUsuarios) WHERE " + "p.idIdiomas = 1 AND " + "DATE(p.fecha) <= DATE(NOW()) AND ((DATE(p.fechaHasta) >= DATE(NOW())) OR (p.fechaHasta IS NULL)) " + "GROUP BY idPublicaciones ORDER BY fecha DESC"; RepeaterRSS.DataSource = TSA.General.Funciones.ConsultarSQL(Command); RepeaterRSS.DataBind(); }
private void BindData(RssFeedDto feed) { litRssLastBuildDate.Text = feed.LastBuildDate.ToString(); litRssDescription.Text = feed.Description; litRssImageUrl.Text = feed.ImageUrl; litRssImageLink.Text = feed.ImageLink; litRssImageTitle.Text = feed.ImageTitle; litRssLanguage.Text = feed.Language; litRssLink.Text = feed.Link; litRssTitle.Text = feed.Title; litRssTtl.Text = feed.Ttl.ToString(); RepeaterRSS.DataSource = feed.Items; RepeaterRSS.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { // Create SqlConnection object SqlConnection sqlConn = new SqlConnection("Data Source=localhost\\SQLEXPRESS;Initial Catalog=MoviesBS;Integrated Security=True;Pooling=False"); // SQL query to retrieve data from database string sqlQuery = "select top 14 * from dbo.Movies order by insertDate DESC;"; // Create SqlCommand object SqlCommand cmd = new SqlCommand(); cmd.Connection = sqlConn; cmd.CommandType = CommandType.Text; cmd.CommandText = sqlQuery; // open connection and then binding data into RepeaterRSS control try { sqlConn.Open(); RepeaterRSS.DataSource = cmd.ExecuteReader(); RepeaterRSS.DataBind(); sqlConn.Close(); }catch { } }