Computer problems,Computer help
*AX SOFT>>>Programming & Design

Best practice looping through database columns or hardcode columnnames?


Which is better when writing data into an HTML table from a database query (with a lot of columns) in Web Programming (e.g. ASP, in this case)?

Iterating through each column, never referencing the actual column name... which saves a lot of room but will need to be changed if the db ever changes structure...
as illustrated:
for

For a=1 To 10
<td>adRecSet(a)</td>
...
Next

Or just hard code column names.. which will have a lot more html:
<td>adRecSet("Col1")</td><td>adRecSet(...

or is the problem systemic and i should run multiple stored procedures on a given page with much less columns returned.

I'm just looking for what ppl believe is the best practice.

Looping through a database by far is better. Because then if you want to expand you already have an object ready to handle it. Dynamic is the way to go.

Tags
  General - Computers & Internet   Software   Security   Programming & Design   Facebook   Flickr   Google   MSN   MySpace
Related information
  • Order online ! help.?

    You need a FormMail script. You just insert your e-mail address and the name of the Order Form File that you will design to accept details of your customer's order, and you will receive an e-...

  • How to terminate a Java while loop using a string?

    Your while condition will always evaluate to true. The expression str != "done" asks whether the reference str is different from the reference "done" - that is, do these ...

  • How do you automatically load a javascipt?

    Put the javascript in a file and in a subfolder of your project and then reference it in the header Example: <script language="javascript" src="scripts/general.js"><...

  • Is there any basic principles or codes needed to design a web page?

    Checkout AceHtmlPro (Free Edition) which will help you learn html and allows for easy page generation. Great for anyone starting out.

    ...
  • Dreamweaver MX: Why has the background & links disappeard on my 3rd page when I link to it from my homepage?

    Where exactly are you storing the specification of your links? In each page? Or in a separate style sheet (CSS)? If you're not using an external style sheet, I highly recommend starting to do ...

  • Unix help!!?

    Files in Unix filesystems use inodes as structures that hold the actual file data on disks. inode number uniquely identifies a physical file on disk. Hard links are pretty much multiple names fo...

  • Entering words in to C++?

    It's as simple as this, in C++: string s; cin >> s;

    ...
  • Does Gimp work on Vista?

    GIMP should run on any NT-based version of Windows (NT4, 2000, XP or Vista). Older GIMP versions (2.0.x) could also work with older versions of Windows such as Windows 95 but they are not supported...

  •  

    Categories--Copyright/IP Policy--Contact Webmaster