Click here to Skip to main content
14,383,503 members
Rate this:
Please Sign up or sign in to vote.
See more:
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
<div class="box-body table-responsive no-padding">
              <table ID="tdb" class="table table-hover" >
                <tr>
                  <th>ID</th>
                  <th>User</th>
                     <th>Password</th>
Posted
Updated 3-May-19 23:10pm
Comments
Richard Deeming 9-May-19 14:00pm
   
<th>Password</th>

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

Rate this:
Please Sign up or sign in to vote.

Solution 1

Your best bet, in ASP.NET (which is obsolete) is to use a repeater to build your bootstrap table out of a data source
   
Comments
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, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100