Click here to Skip to main content
15,793,609 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Good day everyone i am working on a project on 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)
                SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\odt\Documents\login.mdf;Integrated Security=True;Connect Timeout=30");
                SqlCommand cmd = new SqlCommand();
                cmd.CommandText = "select * from [log] ";
                cmd.Connection = con;
                SqlDataReader dt = cmd.ExecuteReader();

                if (dt.HasRows)
                    if (dt.Read())
            //    cmd.ExecuteNonQuery();

this is the html table
<div class="box-body table-responsive no-padding">
              <table ID="tdb" class="table table-hover" >
Updated 3-May-19 23:10pm
Richard Deeming 9-May-19 14:00pm    

I hope that doesn't mean you're storing passwords in plain text?!

Secure Password Authentication Explained Simply[^]
Salted Password Hashing - Doing it Right[^]

1 solution

Your best bet, in ASP.NET (which is obsolete) is to use a repeater to build your bootstrap table out of a data source
Share this answer
akinwunmi 5-May-19 17:08pm    
please how can i use A repeater
Christian Graus 5-May-19 18:14pm    
Honestly, why are you learning a framework that's been obsolete for a decade? ASP.NET was pretty great in 2002, I'd never use it now. Nor does anyone else.

Code Project has been around since the 90s. I am sure if you search, it has articles on how to use a repeater. That tells me you really don't know any ASP.NET yet . This is a good time to ask yourself why you're studying this.
Richard Deeming 9-May-19 13:59pm    
Everyone who has existing WebForms sites, and neither the time nor the budget to completely rewrite them, is still using WebForms.

And everyone who's been writing sites in MVC for the last decade is now on an "obsolete" framework, since everything has to be .NET Core now.

Or should that be Razor Pages?

Or Blazor?

Or whatever Microsoft's next web framework is?


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900