-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIndex.aspx.cs
More file actions
25 lines (24 loc) · 780 Bytes
/
Copy pathIndex.aspx.cs
File metadata and controls
25 lines (24 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Index : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack){
using (SqlConnection con = new SqlConnection("Server=AME0556356W10-1\\ALUNO01;Database=db_google;Trusted_Connection=Yes;"))
{
using (SqlCommand cmd = new SqlCommand("SELECT * FROM tb_Posts", con))
{
con.Open();
dtlPosts.DataSource = cmd.ExecuteReader();
dtlPosts.DataBind();
}
}
}
}
}