Good day everyone i am working on a project on asp.net webform. i am using a template that has an already made table so i want to collect the table to the database so it can fetch out all the information and send it to the table. i wamnt the already made table to show everything on the database without creating from scratch
What I have tried:StringBuilder table = new StringBuilder();
protected void Page_Load(object sender, EventArgs e)
{
if(!Page.IsPostBack)
{
SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\odt\Documents\login.mdf;Integrated Security=True;Connect Timeout=30");
;
con.Open();
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "select * from [log] ";
cmd.Connection = con;
SqlDataReader dt = cmd.ExecuteReader();
if (dt.HasRows)
{
if (dt.Read())
{
}
}
// cmd.ExecuteNonQuery();
con.Close();
}
this is the html table
ID | User | Password |
---|
解决方案
Your best bet, in ASP.NET (which is obsolete) is to use a repeater to build your bootstrap table out of a data source